mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2026-05-04 15:49:49 +02:00
build
This commit is contained in:
@@ -16,6 +16,8 @@ import time
|
|||||||
import base64
|
import base64
|
||||||
import shutil
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
|
import tempfile
|
||||||
|
import subprocess
|
||||||
from portainer.api import PortainerApi
|
from portainer.api import PortainerApi
|
||||||
from git import Repo
|
from git import Repo
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
@@ -224,6 +226,37 @@ def wl(msg):
|
|||||||
if args.debug:
|
if args.debug:
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
|
def run(cmd, cwd=None):
|
||||||
|
result = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True)
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise RuntimeError(result.stderr)
|
||||||
|
return result.stdout.strip()
|
||||||
|
|
||||||
|
def get_compose_files():
|
||||||
|
#git clone --depth=1 --filter=blob:none --no-checkout https://github.com/user/repo.git
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
repo_path = os.path.join(tmpdir, "repo")
|
||||||
|
|
||||||
|
# Clone with minimal data (no checkout, no blobs)
|
||||||
|
run([
|
||||||
|
"git", "clone",
|
||||||
|
"--depth=1",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"--no-checkout",
|
||||||
|
"git@gitlab.sectorq.eu:/jaydee/docker-compose.git",
|
||||||
|
repo_path
|
||||||
|
])
|
||||||
|
|
||||||
|
# List files in HEAD
|
||||||
|
output = run([
|
||||||
|
"git", "ls-tree",
|
||||||
|
"-r",
|
||||||
|
"HEAD",
|
||||||
|
"--name-only"
|
||||||
|
], cwd=repo_path)
|
||||||
|
|
||||||
|
print(output)
|
||||||
|
|
||||||
|
|
||||||
def prompt_missing_args(args_in, defaults_in, fields, action=None,stacks=None):
|
def prompt_missing_args(args_in, defaults_in, fields, action=None,stacks=None):
|
||||||
"""
|
"""
|
||||||
@@ -259,6 +292,7 @@ def prompt_missing_args(args_in, defaults_in, fields, action=None,stacks=None):
|
|||||||
elif field == "stack":
|
elif field == "stack":
|
||||||
if args.action == "create_stack":
|
if args.action == "create_stack":
|
||||||
# input(json.dumps(stacks, indent=2))
|
# input(json.dumps(stacks, indent=2))
|
||||||
|
get_compose_files()
|
||||||
commands = [
|
commands = [
|
||||||
'api_server', 'authentik', 'bitwarden', 'bookstack', 'databasus', 'dockermon', 'duplicati', 'fail2ban', 'filebrowser', 'gitea', 'gitlab', 'grafana', 'grocy',
|
'api_server', 'authentik', 'bitwarden', 'bookstack', 'databasus', 'dockermon', 'duplicati', 'fail2ban', 'filebrowser', 'gitea', 'gitlab', 'grafana', 'grocy',
|
||||||
'hashicorp', 'home-assistant', 'homebox','homepage', 'immich', 'influxdb', 'jupyter', 'kestra', 'kopia', 'linkding', 'linkwarden', 'mailu3',
|
'hashicorp', 'home-assistant', 'homebox','homepage', 'immich', 'influxdb', 'jupyter', 'kestra', 'kopia', 'linkding', 'linkwarden', 'mailu3',
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import tabulate
|
|||||||
from git import Repo
|
from git import Repo
|
||||||
import requests
|
import requests
|
||||||
import hvac
|
import hvac
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
from prompt_toolkit import prompt
|
from prompt_toolkit import prompt
|
||||||
from prompt_toolkit.completion import WordCompleter
|
from prompt_toolkit.completion import WordCompleter
|
||||||
from prompt_toolkit.shortcuts import checkboxlist_dialog
|
from prompt_toolkit.shortcuts import checkboxlist_dialog
|
||||||
|
|||||||
Reference in New Issue
Block a user