Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
219 lines (185 loc) · 7.49 KB
/
Copy pathTaskfile.yml
File metadata and controls
219 lines (185 loc) · 7.49 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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
---
version: "3"
vars:
NAME: vsphere
BINARY: packer-plugin-{{.NAME}}
PLUGIN_FQN:
sh: grep -E '^module' <go.mod | sed -E 's/module *//'
COUNT: '{{.COUNT | default "1"}}'
TEST:
sh: go list ./... | tr '\n' ' '
HASHICORP_PACKER_PLUGIN_SDK_VERSION:
sh: go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2
tasks:
build:
desc: Build the plugin binary.
cmds:
- go build -o {{.BINARY}}
dev:
desc: Build and install the plugin locally for development.
cmds:
- go build -ldflags="-X '{{.PLUGIN_FQN}}/version.VersionPrerelease=dev'" -o "{{.BINARY}}"
- packer plugins install --path {{.BINARY}} "{{.PLUGIN_FQN | replace "packer-plugin-" ""}}"
test:
desc: Run unit tests.
cmds:
- go test -race -count {{.COUNT}} {{.TEST}} -timeout=3m
install-packer-sdc:
desc: Install the packer-sdc plugin-check tool for use in other tasks.
cmds:
- go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@{{.HASHICORP_PACKER_PLUGIN_SDK_VERSION}}
plugin-check:
desc: Run packer-sdc plugin-check against the built binary to validate it meets the plugin SDK requirements.
deps: [install-packer-sdc, build]
cmds:
- |
export PATH="$(go env GOPATH)/bin:$PATH"
packer-sdc plugin-check {{.BINARY}}
testacc:
desc: Run all acceptance tests.
deps: [dev]
cmds:
- PACKER_ACC=1 go test -count {{.COUNT}} -v {{.TEST}} -timeout=180m
testacc-datasource:
desc: Run datasource acceptance tests against a live vCenter.
vars:
TESTACC_DATASOURCE_RUN: '{{.TESTACC_DATASOURCE_RUN | default "TestAccDatasource"}}'
cmds:
- PACKER_ACC=1 go test ./datasource/... -count {{.COUNT}} -v -timeout=15m -run '{{.TESTACC_DATASOURCE_RUN}}'
testacc-builder-iso:
desc: Run vsphere-iso matrix acceptance tests (Alpine installs).
deps: [dev]
vars:
TESTACC_BUILDER_ISO_RUN: '{{.TESTACC_BUILDER_ISO_RUN | default "TestAccISOBuilder_Matrix"}}'
cmds:
- PACKER_ACC=1 go test ./builder/vsphere/iso -count {{.COUNT}} -v -timeout=180m -run '{{.TESTACC_BUILDER_ISO_RUN}}'
testacc-builder-clone:
desc: Run vsphere-clone matrix acceptance tests.
deps: [dev]
vars:
TESTACC_BUILDER_CLONE_RUN: '{{.TESTACC_BUILDER_CLONE_RUN | default "TestAccCloneBuilder_Matrix"}}'
cmds:
- PACKER_ACC=1 go test ./builder/vsphere/clone -count {{.COUNT}} -v -timeout=30m -run '{{.TESTACC_BUILDER_CLONE_RUN}}'
testacc-builder:
desc: Run all builder acceptance tests.
deps: [testacc-builder-iso, testacc-builder-clone]
testacc-post-processor-vsphere:
desc: Run vsphere post-processor acceptance tests.
deps: [dev]
vars:
TESTACC_POST_PROCESSOR_VSPHERE_RUN: '{{.TESTACC_POST_PROCESSOR_VSPHERE_RUN | default "TestAccPostProcessorVSphere_Matrix"}}'
cmds:
- PACKER_ACC=1 go test ./post-processor/vsphere -count {{.COUNT}} -v -timeout=30m -run '{{.TESTACC_POST_PROCESSOR_VSPHERE_RUN}}'
testacc-post-processor-vsphere-template:
desc: Run vsphere-template post-processor acceptance tests.
deps: [dev]
vars:
TESTACC_POST_PROCESSOR_VSPHERE_TEMPLATE_RUN: '{{.TESTACC_POST_PROCESSOR_VSPHERE_TEMPLATE_RUN | default "TestAccPostProcessorVSphereTemplate_Matrix"}}'
cmds:
- PACKER_ACC=1 go test ./post-processor/vsphere-template -count {{.COUNT}} -v -timeout=30m -run '{{.TESTACC_POST_PROCESSOR_VSPHERE_TEMPLATE_RUN}}'
testacc-post-processor:
desc: Run all post-processor acceptance tests.
deps: [testacc-post-processor-vsphere, testacc-post-processor-vsphere-template]
generate:
desc: Run code generation for docs and other generated code.
deps: [install-packer-sdc]
cmds:
- |
export PATH="$(go env GOPATH)/bin:$PATH"
go generate ./...
rm -rf .docs
packer-sdc renderdocs -src "docs" -partials docs-partials/ -dst ".docs/"
./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "hashicorp"
rm -r ".docs"
docs-deps:
desc: Install Zensical and mike into docs-site/.venv for local docs preview.
cmds:
- test -d docs-site/.venv || python3 -m venv docs-site/.venv
- docs-site/.venv/bin/pip install -r docs-site/requirements.txt
docs-prepare:
desc: Stage .web-docs into docs-site/.build/docs for Zensical.
cmds:
- ./docs-site/scripts/prepare-docs.sh
docs-test:
desc: Run all docs-site script unit tests.
cmds:
- ./docs-site/scripts/test/test-all.sh
docs-test-links:
desc: Run integration link rewrite tests for staged documentation.
cmds:
- ./docs-site/scripts/test/test-rewrite-integration-links.sh
docs-test-internal-links:
desc: Run internal link and anchor fix tests for staged documentation.
cmds:
- ./docs-site/scripts/test/test-fix-internal-links.sh
docs-test-admonitions:
desc: Run Material-to-Zensical admonition conversion tests.
cmds:
- ./docs-site/scripts/test/test-convert-admonitions.sh
docs-test-example-labels:
desc: Run HCL/JSON example label formatting tests.
cmds:
- ./docs-site/scripts/test/test-format-example-labels.sh
docs-test-group-example-tabs:
desc: Run HCL/JSON content tab grouping tests.
cmds:
- ./docs-site/scripts/test/test-group-example-tabs.sh
docs-test-normalize:
desc: Run staged markdown list spacing tests.
cmds:
- ./docs-site/scripts/test/test-normalize-list-spacing.sh
docs-test-strip-codegen:
desc: Run strip-codegen-comments tests.
cmds:
- ./docs-site/scripts/test/test-strip-codegen-comments.sh
docs-test-repair-fences:
desc: Run repair-code-fences tests.
cmds:
- ./docs-site/scripts/test/test-repair-code-fences.sh
docs-test-stage-markdown:
desc: Run staged markdown pipeline integration tests.
cmds:
- ./docs-site/scripts/test/test-stage-markdown.sh
docs-test-github-alerts:
desc: Run GitHub alert to admonition conversion tests.
cmds:
- ./docs-site/scripts/test/test-convert-github-alerts.sh
docs-build:
desc: Preview what documentation will look like at the next release (build).
deps: [generate, docs-deps, docs-prepare]
cmds:
- cd docs-site && ../docs-site/.venv/bin/zensical build --config-file zensical.build.toml
docs-serve:
desc: Preview what documentation will look like at the next release (live).
deps: [generate, docs-deps, docs-prepare]
cmds:
- cd docs-site && ../docs-site/.venv/bin/zensical serve --config-file zensical.build.toml
docs-serve-version:
desc: "Preview documentation from a released version."
deps: [docs-deps]
cmds:
- |
test -n "{{.VERSION}}" || (echo "VERSION is required" && exit 1)
rm -rf .web-docs
git checkout "v{{.VERSION}}" -- .web-docs
INCLUDE_EXTRA=true ./docs-site/scripts/prepare-docs.sh
cd docs-site && ../docs-site/.venv/bin/zensical serve --config-file zensical.build.toml
docs-serve-mike:
desc: Preview versioned documentation locally with mike (latest=last tag, development=branch name).
deps: [generate, docs-deps]
env:
MIKE_PREVIEW_VERSIONS: "{{.VERSIONS}}"
cmds:
- ./docs-site/scripts/mike-preview.sh
docs-serve-mike-only:
desc: Serve an existing local mike preview without redeploying.
deps: [docs-deps]
cmds:
- ./docs-site/scripts/mike-preview.sh --serve-only
docs-backfill:
desc: Backfill versioned documentation to GitHub Pages.
deps: [docs-deps]
env:
MIKE_BACKFILL_VERSIONS: "{{.VERSIONS}}"
cmds:
- ./docs-site/scripts/mike-backfill.sh {{.CLI_ARGS}}