-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
100 lines (88 loc) · 2.71 KB
/
justfile
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
# Lists all targets
[private]
default:
@just --list
# Check if files were auto-formated properly
[group('format')]
check-format:
#!/usr/bin/env bash
set -euo pipefail
just --unstable --fmt --check -f justfile
yarn prettier --no-error-on-unmatched-pattern --check **/*.yml **/*.json **/*.md
# Auto-format files
[group('format')]
format:
#!/usr/bin/env bash
set -euo pipefail
just --unstable --fmt -f justfile
yarn prettier --no-error-on-unmatched-pattern --log-level warn --write **/*.yml **/*.json **/*.md
# Lint ansible plays, roles, and configuration
[group('lint')]
ansible-lint:
#!/usr/bin/env bash
set -euo pipefail
cd ansible && ansible-lint
# Lint Dockerfiles with hado
[group('lint')]
hado-lint:
#!/usr/bin/env bash
set -euo pipefail
find . -name "Dockerfile*" -print | while read -r file; do
echo -n "Running \`hadolint\` on ${file}..."
hadolint ${file}
echo "{{ BOLD + GREEN }}OK{{ NORMAL }}"
done
# Lint all Kustomize files to make sure they're well formed
[group('lint')]
kustomize-lint:
#!/usr/bin/env bash
set -euo pipefail
find kustomization/components -mindepth 1 -maxdepth 1 -type d -print | while read -r file; do
echo -n "Running \`kustomize build\` on ${file}..."
kustomize build ${file} > /dev/null
echo "{{ BOLD + GREEN }}OK{{ NORMAL }}"
done
# Lint renovate configuration
[group('lint')]
renovate-lint:
#!/usr/bin/env bash
set -euo pipefail
renovate-config-validator renovate.json
find renovate -name "*.json" -print | while read -r file; do
renovate-config-validator ${file}
done
# Lint shell scripts with shell check
[group('lint')]
shellcheck-lint:
#!/usr/bin/env bash
set -euo pipefail
find . -name "*.sh" -print | while read -r file; do
echo -n "Running \`shellcheck\` on ${file}..."
shellcheck ${file}
echo "{{ BOLD + GREEN }}OK{{ NORMAL }}"
done
# Runs all linters
[group('lint')]
lint: ansible-lint hado-lint kustomize-lint renovate-lint shellcheck-lint
# Run a single test
[group('test')]
kustomization-test component:
ansible-playbook kustomization/tests/{{ component }}/test.yml
# Run all the tests for the kustomize files
[group('test')]
kustomization-tests:
#!/usr/bin/env bash
set -euo pipefail
find kustomization/tests/*/test.yml -print | while read -r file; do
echo -n "Running tests in ${file}..."
ansible-playbook ${file}
echo "{{ BOLD + GREEN }}OK{{ NORMAL }}"
done
# Run all tests
[group('test')]
test: kustomization-tests
# Regenerate Yarn integrations with other tools, like VSCode
regen-yarn-sdks:
#!/usr/bin/env bash
set -euo pipefail
yarn dlx @yarnpkg/sdks