@@ -96,10 +96,10 @@ function Installer{
96
96
$requiredArtifacts | ForEach-Object {
97
97
if (! (Test-Path - Path $PSItem - PathType Leaf)) {
98
98
Write-Host " $PSItem not found."
99
- Write-Host " Make 'podman', 'win-gvproxy' and 'docs' before making the installer:"
99
+ Write-Host " Make 'podman', 'win-gvproxy' and 'docs' (or 'docs-using-podman') before making the installer:"
100
100
Write-Host " .\winmake.ps1 podman-remote"
101
101
Write-Host " .\winmake.ps1 win-gvproxy"
102
- Write-Host " .\winmake.ps1 docs"
102
+ Write-Host " .\winmake.ps1 docs or .\winmake.ps1 docs-using-podman "
103
103
Exit 1
104
104
}
105
105
}
@@ -159,6 +159,7 @@ function Documentation{
159
159
# Check that pandoc is installed
160
160
if (! (Get-Command - Name " pandoc" - ErrorAction SilentlyContinue)) {
161
161
Write-Host " Pandoc not found. Pandoc is required to convert the documentation Markdown files into HTML files."
162
+ Write-Host " Alternatively, use '.\winmake docs-using-podman' to use a container to run pandoc and generate the documentation."
162
163
Exit 1
163
164
}
164
165
# Check that the podman client is built
@@ -170,6 +171,41 @@ function Documentation{
170
171
Run- Command " $PSScriptRoot \docs\make.ps1 $podmanClient "
171
172
}
172
173
174
+ # DocumentationUsingPodman generates documentation with pandoc running in a container.
175
+ # This is usefult on Windows arm64 where pandoc is not available.
176
+ # It's also useful to generate documentation identical to CI.
177
+ # It requires the podman client to be built and a podman machine running.
178
+ # The whole podman git repository is bind mounted in the container at /podman.
179
+ # The documentation is generated by running the command `make podman-remote-windows-docs`.
180
+ # The generated documentation is stored in the directory docs/build/remote.
181
+ function DocumentationUsingPodman {
182
+ Write-Host " Generating documentation artifacts"
183
+ # Check that podman has been built
184
+ $podmanClient = " ${PSScriptRoot} \bin\windows\podman.exe"
185
+ if (! (Test-Path - Path $podmanClient - PathType Leaf)) {
186
+ Write-Host " $podmanClient not found. Make 'podman-remote' before 'documentation'."
187
+ Exit 1
188
+ }
189
+ # Check that a podman machine exist
190
+ $currentMachine = (& ${podmanClient} machine info -f json | ConvertFrom-Json ).Host.CurrentMachine
191
+ if (! $currentMachine ) {
192
+ Write-Host " Podman machine doesn't exist. Initialize and start one before running the validate script."
193
+ Exit 1
194
+ }
195
+ # Check that the podman machine is running
196
+ $state = (& ${podmanClient} machine info -f json | ConvertFrom-Json ).Host.MachineState
197
+ if ($state -ne " Running" ) {
198
+ Write-Host " Podman machine is not running. Start the machine before running the validate script."
199
+ Exit 1
200
+ }
201
+
202
+ Write-Host " Building the image to generate the documentation"
203
+ Run- Command " ${podmanClient} build --build-arg TARGET_OS=windows -t podman-docs-generator ${PSScriptRoot} /docs"
204
+
205
+ Write-Host " Starting the container to run the documentation build"
206
+ Run- Command " ${podmanClient} run -t --rm -v ${PSScriptRoot} :/podman podman-docs-generator"
207
+ }
208
+
173
209
function Validate {
174
210
$podmanExecutable = " podman"
175
211
$podmanSrcVolumeMount = " ${PSScriptRoot} :/go/src/github.com/containers/podman"
@@ -329,6 +365,9 @@ switch ($target) {
329
365
' docs' {
330
366
Documentation
331
367
}
368
+ ' docs-using-podman' {
369
+ DocumentationUsingPodman
370
+ }
332
371
' validatepr' {
333
372
Validate
334
373
}
@@ -359,9 +398,12 @@ switch ($target) {
359
398
Write-Host " Example: Run windows installer tests"
360
399
Write-Host " .\winmake installertest hyperv"
361
400
Write-Host
362
- Write-Host " Example: Generate the documetation artifacts"
401
+ Write-Host " Example: Generate the documentation artifacts"
363
402
Write-Host " .\winmake docs"
364
403
Write-Host
404
+ Write-Host " Example: Generate the documentation artifacts by running pandoc in a container"
405
+ Write-Host " .\winmake docs-using-podman"
406
+ Write-Host
365
407
Write-Host " Example: Validate code changes before submitting a PR"
366
408
Write-Host " .\winmake validatepr"
367
409
Write-Host
0 commit comments