Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

Commit

Permalink
make: implement DEBUG_MODE to ease ansible debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
  • Loading branch information
TomasTomecek committed Feb 26, 2018
1 parent 1d574af commit 739b155
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ DISTRO := fedora-27-x86_64
VARIANT := upstream
DG_BINARY ?= dg
DG_EXEC = $(DG_BINARY) --max-passes 25 --spec specs/common.yml --multispec specs/multispec.yaml --distro $(DISTRO).yaml --multispec-selector variant=$(VARIANT)
# set to 1 to enable debugging
DEBUG_MODE ?= 0
ifeq ($(DEBUG_MODE), 1)
ANSIBLE_EXTRA_ARGS := -vv
endif

REPOSITORY = $(shell ${DG_EXEC} --template={{spec.repository}})

Expand Down Expand Up @@ -51,10 +56,10 @@ enumerate-tools:
check: test

test: build
make -C tests/ check-local IMAGE_NAME=$(REPOSITORY)
make -C tests/ check-local IMAGE_NAME=$(REPOSITORY) ANSIBLE_EXTRA_ARGS=$(ANSIBLE_EXTRA_ARGS)

check-in-vm: build
make -C tests/ check-in-vm IMAGE_NAME=$(REPOSITORY)
make -C tests/ check-in-vm IMAGE_NAME=$(REPOSITORY) ANSIBLE_EXTRA_ARGS=$(ANSIBLE_EXTRA_ARGS)

clean:
rm Dockerfile || :
Expand Down
5 changes: 3 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ IMAGE_NAME := ""
VM_IMAGE_NAME := Fedora-Cloud-Base-27-1.6.x86_64.qcow2
VM_IMAGE_PATH = ../$(VM_IMAGE_NAME)
INVENTORY := /usr/share/ansible/inventory/standard-inventory-qcow2
ANSIBLE_EXTRA_ARGS ?=

check-local:
ansible-playbook -e subject=$(IMAGE_NAME) ./local.yml
ansible-playbook $(ANSIBLE_EXTRA_ARGS) -e subject=$(IMAGE_NAME) ./local.yml

check-in-vm: $(VM_IMAGE_PATH)
TEST_SUBJECTS=$(VM_IMAGE_PATH) ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 -e subject=$(IMAGE_NAME) -i $(INVENTORY) -e setup=true -e vm_image=$(VM_IMAGE) ./in-vm.yml
TEST_SUBJECTS=$(VM_IMAGE_PATH) ansible-playbook $(ANSIBLE_EXTRA_ARGS) -e ansible_python_interpreter=/usr/bin/python3 -e subject=$(IMAGE_NAME) -i $(INVENTORY) -e setup=true -e vm_image=$(VM_IMAGE) ./in-vm.yml

$(VM_IMAGE_PATH):
curl -o $(VM_IMAGE_PATH) -s https://download.fedoraproject.org/fedora/releases/27/CloudImages/x86_64/images/$(VM_IMAGE_NAME)
Expand Down

0 comments on commit 739b155

Please sign in to comment.