-
Notifications
You must be signed in to change notification settings - Fork 74
/
Makefile
84 lines (73 loc) · 2.49 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
TEST_TARGET := ./tests/
BASE_IMAGE := registry.fedoraproject.org/fedora:29
PY_PACKAGE := ansible-bender
# container image with ab inside
CONT_IMG := $(PY_PACKAGE)
ANSIBLE_BENDER := python3 -m ansible_bender.cli
PYTEST_EXEC := pytest
build-ab-img: contrib/setup.yml
$(ANSIBLE_BENDER) build -- ./contrib/setup.yml $(BASE_IMAGE) $(CONT_IMG)
check:
PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=yes $(PYTEST_EXEC) --cov=ansible_bender -l -v $(TEST_TARGET)
check-a-lot:
WITH_TESTS=yes vagrant up --provision
WITH_TESTS=yes vagrant halt
check-in-container:
podman run -ti --rm \
--tmpfs /tmp:rw,nosuid,nodev,size=1000000k \
--privileged \
-e CGROUP_MANAGER=cgroupfs \
-v $(CURDIR):/src \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /src \
$(CONT_IMG) \
make check TEST_TARGET='$(TEST_TARGET)'
shell:
podman run --rm -ti -v $(CURDIR):/src:Z -w /src $(CONT_IMG) bash
push-image-to-dockerd:
podman push $(CONT_IMG) docker-daemon:ansible-bender:latest
run-in-okd:
ansible-playbook -vv ./contrib/run-in-okd.yml
oc get all
sleep 3 # give oc time to spin the container
oc logs -f pod/ab-in-okd-1-build
check-in-okd:
ansible-playbook -vv ./contrib/check-in-okd.yml
oc get all
sleep 2
oc logs -f pod/ab
#FIXME: try outer container to be rootless
# build tests image
# run tests as an unpriv user
# TODO: podman inside needs to use vfs storage driver
check-smoke:
podman run --net=host --rm -ti -v $(CURDIR):/src:Z -w /src registry.fedoraproject.org/fedora:29 bash -c '\
dnf install -y buildah podman \
&& podman pull docker.io/library/python:3-alpine \
&& pip3 install . \
&& ansible-bender build ./tests/data/basic_playbook.yaml docker.io/library/python:3-alpine test'
# for CI
check-in-docker:
docker run --rm --privileged -v $(CURDIR):/src -w /src \
-v /var/run/docker.sock:/var/run/docker.sock \
--tmpfs /tmp:rw,exec,nosuid,nodev,size=1000000k \
$(BASE_IMAGE) \
bash -c " \
set -x \
&& dnf install -y ansible make \
&& ansible-playbook -i 'localhost,' -e ansible_python_interpreter=/usr/bin/python3 -e test_mode=yes -c local ./contrib/setup.yml \
&& id \
&& pwd \
&& podman info \
&& buildah info || : \
&& make check"
# we need exec since we create arbitrary buildah binary
check-in-docker-easy:
docker run -ti --rm \
-v $(CURDIR):/src -w /src \
-e CGROUP_MANAGER=cgroupfs \
--privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
--tmpfs /tmp:rw,exec,nosuid,nodev,size=1000000k \
$(CONT_IMG) \
make check TEST_TARGET='$(TEST_TARGET)'