mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-19 15:04:23 +02:00
Added partial test and skip-build flag
This commit is contained in:
parent
3b2190f7ab
commit
f4d1f2a303
5
Makefile
5
Makefile
@ -61,8 +61,11 @@ build: clean dockerignore
|
|||||||
install: build
|
install: build
|
||||||
@echo "⚙️ Install complete."
|
@echo "⚙️ Install complete."
|
||||||
|
|
||||||
test: build
|
partial-test:
|
||||||
@echo "🧪 Running Python tests…"
|
@echo "🧪 Running Python tests…"
|
||||||
python -m unittest discover -s tests
|
python -m unittest discover -s tests
|
||||||
@echo "📑 Checking Ansible syntax…"
|
@echo "📑 Checking Ansible syntax…"
|
||||||
ansible-playbook playbook.yml --syntax-check
|
ansible-playbook playbook.yml --syntax-check
|
||||||
|
|
||||||
|
test: build partial-test
|
||||||
|
@echo "Full test with build terminated."
|
||||||
|
@ -14,13 +14,17 @@ def run_ansible_playbook(
|
|||||||
password_file=None,
|
password_file=None,
|
||||||
verbose=0,
|
verbose=0,
|
||||||
skip_tests=False,
|
skip_tests=False,
|
||||||
skip_validation=False
|
skip_validation=False,
|
||||||
|
skip_build=False, # <-- new parameter
|
||||||
):
|
):
|
||||||
start_time = datetime.datetime.now()
|
start_time = datetime.datetime.now()
|
||||||
print(f"\n▶️ Script started at: {start_time.isoformat()}\n")
|
print(f"\n▶️ Script started at: {start_time.isoformat()}\n")
|
||||||
|
|
||||||
|
if not skip_build:
|
||||||
print("\n🛠️ Building project (make build)...\n")
|
print("\n🛠️ Building project (make build)...\n")
|
||||||
subprocess.run(["make", "build"], check=True)
|
subprocess.run(["make", "build"], check=True)
|
||||||
|
else:
|
||||||
|
print("\n⚠️ Skipping build as requested.\n")
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
playbook = os.path.join(os.path.dirname(script_dir), "playbook.yml")
|
playbook = os.path.join(os.path.dirname(script_dir), "playbook.yml")
|
||||||
@ -154,6 +158,10 @@ def main():
|
|||||||
"-V", "--skip-validation", action="store_true",
|
"-V", "--skip-validation", action="store_true",
|
||||||
help="Skip inventory validation before deployment."
|
help="Skip inventory validation before deployment."
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-B", "--skip-build", action="store_true",
|
||||||
|
help="Skip running 'make build' before deployment."
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-i", "--id",
|
"-i", "--id",
|
||||||
nargs="+",
|
nargs="+",
|
||||||
@ -187,7 +195,8 @@ def main():
|
|||||||
password_file=args.password_file,
|
password_file=args.password_file,
|
||||||
verbose=args.verbose,
|
verbose=args.verbose,
|
||||||
skip_tests=args.skip_tests,
|
skip_tests=args.skip_tests,
|
||||||
skip_validation=args.skip_validation
|
skip_validation=args.skip_validation,
|
||||||
|
skip_build=args.skip_build # Pass the new param
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user