-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (68 loc) · 2.7 KB
/
Makefile
File metadata and controls
85 lines (68 loc) · 2.7 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
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
from urllib.request import pathname2url
webbrowser.open("docs/_build/html/index.html")
endef
export BROWSER_PYSCRIPT
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
OS_VERSION ?= noble
PUPPET_ENV := $(shell sudo /opt/puppetlabs/bin/facter -p puppet_environment)
PWD := $(shell pwd)
INSTALL_DIR = "/opt/puppet-code"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.PHONY: hooks
hooks: ## Instance git hooks
test -L .git/hooks/pre-commit || ln -fs ../../hooks/pre-commit .git/hooks/pre-commit
bootstrap: ## Install dependencies
apt-get -y install devscripts \
debhelper
all:
@echo "Nothing to build"
install: ## Install the code
mkdir -p "${DESTDIR}${INSTALL_DIR}"
cp -R environments "${DESTDIR}${INSTALL_DIR}"; find "${DESTDIR}${INSTALL_DIR}/environments/" -type f -exec chmod 644 {} \;
cp -R modules "${DESTDIR}${INSTALL_DIR}" ; find "${DESTDIR}${INSTALL_DIR}/modules/" -type f -exec chmod 644 {} \;
.PHONY: package
package: ## Build a deb package
bash support/package.sh
.PHONY: docker
docker: ## Run a container
@docker run -it --rm -v $$PWD:/puppet-code -w /puppet-code ubuntu:noble bash -l
.PHONY: bumpversion
bumpversion:
@docker run --rm -v $$PWD:/puppet-code \
-w /puppet-code \
twindb/ubuntu-debhelper@sha256:0bdd44e6f036974d09bf9c69144256d037f14d47d227bdd45f98e2005f732f99 \
bash -c "DEBEMAIL=packager@infrahouse.com dch --distribution noble -R 'commit event. see changes history in git log'"
.PHONY: test-puppet
test-puppet:
sudo ih-puppet \
--root-directory /home/$(USER)/code/puppet-code \
--environment $(PUPPET_ENV) \
--environmentpath {root_directory}/environments \
--hiera-config {root_directory}/environments/{environment}/hiera.yaml \
--module-path {root_directory}/environments/{environment}/modules:{root_directory}/modules apply
.PHONY: install-infrahouse-repo
install-infrahouse-repo:
# Install dependencies
apt-get update
apt-get install gpg lsb-release curl
# Add a GPG public key to verify InfraHouse packages
mkdir -p /etc/apt/cloud-init.gpg.d/
curl -fsSL https://release-$$(lsb_release -cs).infrahouse.com/DEB-GPG-KEY-release-$$(lsb_release -cs).infrahouse.com \
| gpg --dearmor -o /etc/apt/cloud-init.gpg.d/infrahouse.gpg
# Add the InfraHouse repository source
echo "deb [signed-by=/etc/apt/cloud-init.gpg.d/infrahouse.gpg] https://release-$$(lsb_release -cs).infrahouse.com/ $$(lsb_release -cs) main" \
> /etc/apt/sources.list.d/infrahouse.list
apt-get update