-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.toml
89 lines (78 loc) · 2.61 KB
/
Makefile.toml
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
# ================================================
# Cactuar
# ================================================
#
# Install cargo-make to run these tasks:
# cargo install cargo-make --force
#
# After installation, to run a task:
# cargo make <task>
[config]
default_to_workspace = false
skip_core_tasks = true
[env]
CACTUAR_DOCKER_TARGET = "cactuar"
CACTUAR_HELM_CHART_NAME = "cactuar"
CACTUAR_HELM_CHART_PATH = "./helm/cactuar"
PROM_RULE_CRD_PATH = "https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/setup/0prometheusruleCustomResourceDefinition.yaml"
[tasks.test]
command = "cargo"
args = [ "nextest", "run" ]
install_crate = "cargo-nextest"
[tasks.coverage]
command = "cargo"
args = [ "llvm-cov" ]
install_crate = "cargo-llvm-cov"
[tasks.docs]
command = "cargo"
args = ["doc"]
[tasks.lint]
command = "cargo"
args = ["clippy"]
# Assumes you have Docker installed and running, see:
# https://www.docker.com/get-started/
[tasks.docker]
command = "docker"
args = [
"build",
"--tag", # tag and target are currently the same
"${CACTUAR_DOCKER_TARGET}:${CARGO_MAKE_GIT_HEAD_LAST_COMMIT_HASH_PREFIX}",
"--target",
"${CACTUAR_DOCKER_TARGET}",
".", # build context
]
# Automation with the `-A` flag is not used here due to bug in `kopium` at time
# of writing, where a JSON Schema cannot be derived as the `IntOrString` type
# does not implement the necessary traits.
#
# This is fine, as this only limits us from applying the imported resource
# definition to the cluster as a new resource, when this should already be
# managed by `kube-prometheus-stack`, performing operations against the CRD,
# such as creation, getting, or deletion will still work just fine.
[tasks.import-crds]
script = '''
curl ${PROM_RULE_CRD_PATH} | \
kopium --docs -f - > ./src/crd/prom_rule.rs
'''
# Assumes you have Helm installed, see: https://helm.sh/docs/intro/install/
#
# This command just prints the Helm template output to stdout. If you want to
# put the contents in a file to examine or search through it, redirect the
# output to a file.
[tasks.helm-preview]
command = "helm"
args = [
"template",
"${CACTUAR_HELM_CHART_NAME}",
"${CACTUAR_HELM_CHART_PATH}",
]
# We need to deploy the Custom Resource Definition as part of the Helm chart,
# this script task will generate the specification for the CRD and overwrite the
# current specification located within the Helm chart template directory.
#
# Updating the specification in Kubernetes can then be done by deploying the
# Helm chart.
[tasks.helm-crd]
script = '''
cargo run --bin crdgen > ${CACTUAR_HELM_CHART_PATH}/templates/crdspec.yaml
'''