-
Notifications
You must be signed in to change notification settings - Fork 9.2k
193 lines (179 loc) · 7.91 KB
/
website.yml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
## These checks will be superseded by documentation.yml
## when the provider documentation layout is moved to
## the Terraform Registry layout.
name: Website Checks
on:
push:
branches:
- main
- "release/**"
pull_request:
paths:
- .github/workflows/website.yml
- .ci/.markdownlinkcheck.json
- .ci/.tflint.hcl
- .ci/tools/go.mod
- .markdownlint.yml
- website/docs/**
jobs:
markdown-link-check-a-h-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: YakDriver/md-check-links@9044b7162323b91150cef35355e1a3514564aa82
name: markdown-link-check website/docs/**/[a-h].markdown
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".ci/.markdownlinkcheck.json"
folder-path: "website/docs/r, website/docs/d"
file-prefix: "[a-h]"
file-extension: ".markdown"
base-branch: "main"
check-modified-files-only: "no"
markdown-link-check-i-z-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: YakDriver/md-check-links@9044b7162323b91150cef35355e1a3514564aa82
name: markdown-link-check website/docs/**/[i-z].markdown
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".ci/.markdownlinkcheck.json"
folder-path: "website/docs/r, website/docs/d"
file-prefix: "[i-z]"
file-extension: ".markdown"
base-branch: "main"
check-modified-files-only: "no"
markdown-link-check-md:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: YakDriver/md-check-links@9044b7162323b91150cef35355e1a3514564aa82
name: markdown-link-check website/docs/**/*.md
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".ci/.markdownlinkcheck.json"
folder-path: "website/docs"
file-extension: ".md"
base-branch: "main"
check-modified-files-only: "yes"
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb
with:
args: "website/docs"
misspell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version-file: .ci/tools/go.mod
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd .ci/tools && go install github.com/client9/misspell/cmd/misspell
- run: misspell -error -source text website/
terrafmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version-file: .ci/tools/go.mod
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd .ci/tools && go install github.com/katbyte/terrafmt
- run: terrafmt diff ./website --check --pattern '*.markdown'
tflint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
fetch-depth: 0
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version-file: .ci/tools/go.mod
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd .ci/tools && go install github.com/katbyte/terrafmt
- run: cd .ci/tools && go install github.com/terraform-linters/tflint
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ runner.os }}-tflint-${{ hashFiles('.ci/.tflint.hcl') }}
- run: tflint --config .ci/.tflint.hcl --init
- run: |
exit_code=0
# Configure the rules for tflint.
# The *_invalid_* rules disabled here prevent evaluation of expressions.
# Do not disable *_invalid_name rules, since these are good checks for e.g. "%s" formatting verbs
# being carried over from test cases.
shared_rules=(
"--enable-rule=terraform_comment_syntax"
"--disable-rule=aws_cloudwatch_event_target_invalid_arn"
"--disable-rule=aws_db_instance_default_parameter_group"
"--disable-rule=aws_elasticache_cluster_default_parameter_group"
"--disable-rule=aws_elasticache_replication_group_default_parameter_group"
"--disable-rule=aws_iam_policy_sid_invalid_characters"
"--disable-rule=aws_iam_saml_provider_invalid_saml_metadata_document"
"--disable-rule=aws_iam_server_certificate_invalid_certificate_body"
"--disable-rule=aws_iam_server_certificate_invalid_private_key"
"--disable-rule=aws_iot_certificate_invalid_csr"
"--disable-rule=aws_lb_invalid_load_balancer_type"
"--disable-rule=aws_lb_target_group_invalid_protocol"
"--disable-rule=aws_networkfirewall_rule_group_invalid_rules"
"--disable-rule=aws_s3_object_copy_invalid_source"
"--disable-rule=aws_servicecatalog_portfolio_share_invalid_type"
"--disable-rule=aws_transfer_ssh_key_invalid_body"
"--disable-rule=aws_worklink_website_certificate_authority_association_invalid_certificate"
"--disable-rule=terraform_required_providers"
"--disable-rule=terraform_unused_declarations"
"--disable-rule=terraform_typed_variables"
)
while read -r filename; do
rules=("${shared_rules[@]}")
if [[ "$filename" == "./website/docs/guides/version-2-upgrade.html.md" ]]; then
# ./website/docs/guides/version-2-upgrade.html.md should still include pre-0.12 syntax,
# since v1.0 does not support Terraform 0.12.
rules+=(
"--disable-rule=terraform_deprecated_index"
"--disable-rule=terraform_deprecated_interpolation"
)
elif [[ "$filename" == "./website/docs/guides/version-3-upgrade.html.md" ]]; then
# ./website/docs/guides/version-3-upgrade.html.md has one example showing migration from
# pre-0.12 syntax to 0.12 syntax. We can't customize rules per block, and adding a
# tflint-ignore directive to documentation is not ideal.
rules+=(
"--enable-rule=terraform_deprecated_index"
"--disable-rule=terraform_deprecated_interpolation"
)
else
rules+=(
"--enable-rule=terraform_deprecated_index"
"--enable-rule=terraform_deprecated_interpolation"
)
fi
# We need to capture the output and error code here. We don't want to exit on the first error
set +e
./.ci/scripts/validate-terraform-file.sh "$filename" "${rules[@]}" || exit_code=1
set -e
done < <(find ./website/docs -type f \( -name '*.md' -o -name '*.markdown' \) | sort -u)
exit $exit_code