Add Gitea build, container tests and registry publication
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
This commit is contained in:
32
ci/runner/configure-docker.py
Normal file
32
ci/runner/configure-docker.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Merge this project's HTTP registry into a selected daemon JSON file."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
sys.exit('Usage: python3 ci/runner/configure-docker.py <daemon.json>')
|
||||
path = Path(sys.argv[1]).expanduser()
|
||||
data = json.loads(path.read_text()) if path.exists() else {}
|
||||
registries = data.setdefault('insecure-registries', [])
|
||||
if not isinstance(registries, list):
|
||||
sys.exit('Existing insecure-registries must be an array; configuration left unchanged')
|
||||
if '192.168.2.28:3000' in registries:
|
||||
print('Internal registry already configured; no change')
|
||||
sys.exit(0)
|
||||
registries.append('192.168.2.28:3000')
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
if path.exists():
|
||||
backup = path.with_name(path.name + '.before-agiledancers')
|
||||
if not backup.exists():
|
||||
shutil.copy2(path, backup)
|
||||
# Write in the same directory, then replace atomically.
|
||||
temporary = path.with_name(path.name + '.agiledancers.tmp')
|
||||
with temporary.open('x') as output:
|
||||
json.dump(data, output, indent=2)
|
||||
output.write('\n')
|
||||
if path.exists():
|
||||
shutil.copymode(path, temporary)
|
||||
temporary.replace(path)
|
||||
print('Internal registry added; restart/apply Docker Engine configuration to activate')
|
||||
Reference in New Issue
Block a user