-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (88 loc) · 3.17 KB
/
Makefile
File metadata and controls
101 lines (88 loc) · 3.17 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.DEFAULT_GOAL:=ansible-lint
MAKEFLAGS=--warn-undefined-variables
playbooks:=$(wildcard playbooks/*.yml)
kaniko_img:=gcr.io/kaniko-project/executor:v1.24.0-debug
ifneq ("$(shell command -v podman)", "")
CONTAINER?=podman
else ifneq ("$(shell command -v docker)", "")
CONTAINER?=docker
else
$(warning no container platform found. Cannot run test targets.)
endif
define build_image
@# $1 is the OS
@# $2 is the OS_VERSION
$(CONTAINER) run \
--entrypoint='' \
--name="perobertson-setup-build-$(1)-$(2)" \
--rm \
-v "$(shell pwd):/worksapce:z" \
-w /worksapce \
$(kaniko_img) \
./.gitlab/build_image.sh $(1) $(2)
$(CONTAINER) load -i dockerfiles/dist/$(1)/$(1)-$(2).tar
endef
dockerfiles/dist/fedora/fedora-41.tar: ./.gitlab/build_image.sh
dockerfiles/dist/fedora/fedora-41.tar: dockerfiles/fedora.dockerfile
$(call build_image,fedora,41)
dockerfiles/dist/fedora/fedora-42.tar: ./.gitlab/build_image.sh
dockerfiles/dist/fedora/fedora-42.tar: dockerfiles/fedora.dockerfile
$(call build_image,fedora,42)
dockerfiles/dist/fedora/fedora-43.tar: ./.gitlab/build_image.sh
dockerfiles/dist/fedora/fedora-43.tar: dockerfiles/fedora.dockerfile
$(call build_image,fedora,43)
dockerfiles/dist/ubuntu/ubuntu-24.04.tar: ./.gitlab/build_image.sh
dockerfiles/dist/ubuntu/ubuntu-24.04.tar: dockerfiles/ubuntu.dockerfile
$(call build_image,ubuntu,24.04)
.PHONY: ansible-lint
ansible-lint:
ansible-playbook --syntax-check $(playbooks)
ansible-lint -s -p playbooks
define test_os
@# $1 is the OS
@# $2 is the OS_VERSION
@# TODO: rustup executes files in /tmp. Needed to drop noexec
if uname -a | grep '\-WSL'; then \
$(CONTAINER) create \
--env ANSIBLE_FORCE_COLOR=1 \
--interactive \
--name="perobertson-setup-$(1)-$(2)" \
--rm \
--tty \
--volume="$(shell pwd):/setup" \
--workdir /setup \
"localhost/perobertson-setup-$(1):$(2)" || true; \
else \
$(CONTAINER) create \
--env ANSIBLE_FORCE_COLOR=1 \
--interactive \
--name="perobertson-setup-$(1)-$(2)" \
--rm \
--tmpfs="/run:rw,noexec,nosuid,nodev" \
--tmpfs="/tmp:rw,nosuid,nodev" \
--tty \
--volume="/sys/fs/cgroup:/sys/fs/cgroup:ro" \
--volume="$(shell pwd):/setup" \
--workdir /setup \
"localhost/perobertson-setup-$(1):$(2)" /lib/systemd/systemd || true; \
fi
$(CONTAINER) start "perobertson-setup-$(1)-$(2)" || true
@# The container must run as root for systemd
@# This means we need to explicitly start a different session for the user
$(CONTAINER) exec "perobertson-setup-$(1)-$(2)" su public --command="./setup.sh"
$(CONTAINER) exec "perobertson-setup-$(1)-$(2)" su public --command="./.gitlab/check_versions.bash"
$(CONTAINER) exec "perobertson-setup-$(1)-$(2)" su public --command="./.gitlab/verify_no_changes.sh"
$(CONTAINER) stop "perobertson-setup-$(1)-$(2)"
endef
.PHONY: test-fedora-41
test-fedora-41: dockerfiles/dist/fedora/fedora-41.tar
$(call test_os,fedora,41)
.PHONY: test-fedora-42
test-fedora-42: dockerfiles/dist/fedora/fedora-42.tar
$(call test_os,fedora,42)
.PHONY: test-fedora-43
test-fedora-43: dockerfiles/dist/fedora/fedora-43.tar
$(call test_os,fedora,43)
.PHONY: test-ubuntu-24.04
test-ubuntu-24.04: dockerfiles/dist/ubuntu/ubuntu-24.04.tar
$(call test_os,ubuntu,24.04)