forked from canonical/observability-stack
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
74 lines (60 loc) · 2.4 KB
/
justfile
File metadata and controls
74 lines (60 loc) · 2.4 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
set quiet # Recipes are silent by default
set export # Just variables are exported to the environment
terraform := `which terraform || which tofu || echo ""` # require 'terraform' or 'opentofu'
uv_flags := "--frozen --isolated"
[private]
default:
just --list
# Update uv.lock with the latest deps
lock:
uv lock --upgrade --no-cache
# Lint everything
[group("Lint")]
lint: lint-workflows lint-terraform lint-terraform-docs
# Format everything
[group("Format")]
fmt: format-terraform format-terraform-docs
# Run unit tests
[group("Unit")]
unit: (unit-test "cos") (unit-test "cos-lite")
# Lint the Github workflows
[group("Lint")]
lint-workflows:
uvx --from=actionlint-py actionlint
# Lint the Terraform modules
[group("Lint")]
[working-directory("./terraform")]
lint-terraform:
if [ -z "${terraform}" ]; then echo "ERROR: please install terraform or opentofu"; exit 1; fi
set -e; for repo in */; do (cd "$repo" && echo "Processing ${repo%/}..." && $terraform init -upgrade && $terraform fmt -check -recursive -diff) || exit 1; done
# Lint the Terraform documentation
[group("Lint")]
lint-terraform-docs:
terraform-docs --config .tfdocs-config.yml --output-check .
# Format the Terraform modules
[group("Format")]
[working-directory("./terraform")]
format-terraform:
if [ -z "${terraform}" ]; then echo "ERROR: please install terraform or opentofu"; exit 1; fi
set -e; for repo in */; do (cd "$repo" && echo "Processing ${repo%/}..." && $terraform init -upgrade && $terraform fmt -recursive -diff) || exit 1; done
# Format the Terraform documentation
[group("Format")]
format-terraform-docs:
terraform-docs --config .tfdocs-config.yml .
# Validate the Terraform modules
[group("Static")]
[working-directory("./terraform")]
validate-terraform:
if [ -z "${terraform}" ]; then echo "ERROR: please install terraform or opentofu"; exit 1; fi
set -e; for repo in */; do (cd "$repo" && echo "Processing ${repo%/}..." && $terraform init -upgrade && $terraform validate) || exit 1; done
# Run a unit test
[group("Unit")]
[working-directory("./terraform")]
unit-test module:
if [ -z "${terraform}" ]; then echo "ERROR: please install terraform or opentofu"; exit 1; fi
$terraform -chdir={{module}} init -upgrade && $terraform -chdir={{module}} test
# Run integration tests
[group("Integration")]
[working-directory("./tests/integration")]
integration *args='':
uv run ${uv_flags} pytest -vv --capture=no --exitfirst "${args}"