-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy path.pre-commit-config.yaml
103 lines (99 loc) · 4.32 KB
/
.pre-commit-config.yaml
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
102
103
exclude: '^alpine-packages/.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
types: [file]
files: "(.json$|.json.j2$)"
- id: check-yaml
- id: end-of-file-fixer
- id: file-contents-sorter
args: ["--ignore-case"]
files: '^.gitignore$'
- id: mixed-line-ending
args: ["--fix=lf"]
- id: trailing-whitespace
- repo: https://github.com/detailyang/pre-commit-shell
rev: v1.0.6
hooks:
- id: shell-lint
name: "Verify .circleci/kickoff_qa_tests.sh is valid Bash"
types: [file]
files: ".circleci/kickoff_qa_tests.sh"
- repo: local
hooks:
- id: copyright-uptodate
name: Keep Copyright Year Up to Date
language: python
entry: python3 .circleci/pre-commit-scripts/copyright.py
- id: circle-config-yaml
name: Checks for consistency between config.yml and config.yml.j2
language: python
additional_dependencies: ['jinja2']
files: "config.yml$|config.yml.j2|generate_circleci_config.py$"
entry: python3 .circleci/generate_circleci_config.py
- id: check-different-arg-values
name: Checking that all ARG variable values agree with each other in Dockerfiles
files: "^(\\d+\\.\\d+\\.\\d+.*|main)/\\w+/Dockerfile$"
types: [file, dockerfile]
language: script
entry: .circleci/bin/check-different-arg-values.sh
- id: update-dockerfiles
name: Updates all Dockerfiles with their respective version numbers and constraint files
language: python
files: "(common|update_dockerfiles).py$|Dockerfile$"
entry: python3 .circleci/update_dockerfiles.py
require_serial: true
- id: verify-changelog-entries
name: Verifies individual CHANGELOG files for each release and adds links to README.md
language: python
files: "(common|verify_changelog_entries).py$|README.md$|CHANGELOG.md$"
entry: python3 .circleci/verify_changelog_entries.py
require_serial: true
- id: check-for-jq
name: Check for workable jq
language: system
entry: |
bash -c "which jq"
- id: check-for-yq
name: Check for workable yq
language: system
entry: |
bash -c "which yq"
- id: verify-generated-config-yaml-syntax
name: Verify generated config.yml is valid YAML
language: python
additional_dependencies: ['jinja2']
files: ".*.j2$|.circleci/.*.py$"
entry: |
python3 .circleci/generate_circleci_config.py \
| yq eval . -
- id: verify-generated-slack-message-templates-json-syntax
name: Verify generated Slack message templates are valid JSON
language: python
additional_dependencies: ['jinja2']
files: ".circleci/(config.yml.j2|common.py|generate_circleci_config.py$|new_build_slack_approval.json.j2|new_dev_build_slack_notification.json.j2|push.bash.j2|regression_test_slack_approval.json.j2|regression_test_slack_notification.json.j2|smoke_test_slack_notification.json.j2)"
entry: |
python3 .circleci/generate_circleci_config.py \
| yq --output-format=json eval . - \
| jq '.workflows."certified-airflow".jobs[]
| select(type == "object" and keys[] | startswith("slack/"))
| keys[0] as $k
| .[$k].custom
| fromjson'
- id: verify-generated-slack-notification-templates-json-syntax
name: Verify generated Slack notification templates are valid JSON
language: python
additional_dependencies: ['jinja2']
files: ".circleci/(config.yml.j2|common.py|generate_circleci_config.py$|new_build_slack_approval.json.j2|new_dev_build_slack_notification.json.j2|push.bash.j2|regression_test_slack_approval.json.j2|regression_test_slack_notification.json.j2|smoke_test_slack_notification.json.j2)"
entry: |
python3 .circleci/generate_circleci_config.py \
| yq --output-format=json eval . - \
| jq '.jobs[].steps[]
| select(type == "object" and (keys[] | startswith("slack/")))
| keys[0] as $k
| .[$k].custom
| fromjson'