Skip to content

Commit 1aa3f70

Browse files
authored
Merge branch 'main' into rishichawda/fix-quiet-mode-docs
2 parents 69b7e3d + 66dca97 commit 1aa3f70

File tree

131 files changed

+7253
-490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+7253
-490
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ nodrafts: bundle
2929
production: bundle
3030
hugo --gc --minify --enableGitInfo
3131

32+
static: bundle
33+
hugo --gc --enableGitInfo --cleanDestinationDir
34+
3235
deploy_preview: bundle
3336
hugo --gc --minify --enableGitInfo --buildFuture
3437

@@ -38,6 +41,9 @@ serve_ignore_vendor: bundle
3841
test_theme: bundle
3942
HUGO_MODULE_WORKSPACE=hugo.work hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths "github.com/chef/chef-docs-theme"
4043

44+
test_theme_production: bundle
45+
HUGO_MODULE_WORKSPACE=hugo.work hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths "github.com/chef/chef-docs-theme" --environment production
46+
4147
# https://gohugo.io/troubleshooting/audit/
4248
audit: bundle
4349
HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|\[i18n\]|\(<nil>\)|(&lt;nil&gt;)|hahahugo" public/
@@ -47,7 +53,12 @@ lint: bundle
4753

4854
update_theme:
4955
hugo mod get -u github.com/chef/chef-docs-theme
56+
rm -rf _vendor
57+
rm -rf node_modules
58+
hugo mod tidy
59+
hugo mod vendor
5060
hugo mod npm pack
61+
npm install
5162

5263
## See:
5364
## - https://cspell.org/docs/getting-started/

README.md

Lines changed: 111 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If you don't find style guidance in the Chef Documentation Style Guide, use [Goo
1818
## Distributed documentation
1919

2020
The Chef documentation source is highly distributed and depends on [Hugo modules](https://gohugo.io/hugo-modules/) to pull in documentation from other Chef repositories.
21-
The content from those repositories is [vendored](#hugo-vendoring) in chef-web-docs.
21+
The content from those repositories is [vendored](#update-documentation-from-other-repositories) in chef-web-docs.
2222

2323
To make changes to the content in those repositories, submit pull requests to the appropriate repository. don't submit pull requests to the vendored files in chef-web-docs. We will update those changes after they're merged or after a new version of a product is released.
2424

@@ -70,28 +70,15 @@ fix build errors before we merge, so you don't have to
7070
worry about passing all of the CI checks, but it might add an extra
7171
few days. The important part is submitting your change.
7272

73-
## Edit on GitHub links
74-
75-
We use a partial `edit_on_github.html` to add "Edit on GitHub" links to each page.
76-
77-
Each page should have a `gh_repo` parameter set to the value of the GitHub repository
78-
that the page comes from. For example, `gh_repo = "chef-server"`
79-
80-
Each repository with documentation has a `config.toml` file with a `params.<REPOSITORY>`
81-
map and a `gh_path` parameter set to the path of the docs content directory in
82-
that repository.
83-
84-
The `edit_on_github` partial appends the page file name to the end of `gh_path`
85-
parameter and adds the link to the text of the page.
86-
8773
## Local development environment
8874

8975
The Chef Documentation website is built using:
9076

91-
- [Hugo](https://gohugo.io/) 0.123.4 or higher
77+
- [Hugo](https://gohugo.io/) 0.142.0 or higher
9278
- [Node](https://www.nodejs.com) 20.0.0 or higher
9379
- [NPM](https://www.npmjs.com/) 10.4.0 or higher
9480
- [Go](https://golang.org/dl/) 1.22 or higher
81+
- [Dart Sass](https://sass-lang.com/dart-sass/) 2.7.1
9582

9683
To install Hugo, NPM, and Go on Windows, run:
9784

@@ -123,61 +110,6 @@ To clean your local development environment:
123110
in addition to the functions of `make clean` described above. Those node
124111
modules will be reinstalled the next time you run `make serve`.
125112

126-
## Site theme
127-
128-
The theme for this site is deployed from the [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme/) repository.
129-
130-
### Node modules
131-
132-
The Node modules defined in the `package.json` file are sourced from the `package.hugo.json` file in the `chef/chef-docs-theme` repository.
133-
To update these Node dependencies, update them in `chef/chef-docs-theme`, then [update the theme and the `package.json` file](#update-theme) in this repository.
134-
135-
### Local theme testing
136-
137-
You can test local changes made to the chef-docs-theme repository and preview those changes using Hugo's local development server.
138-
To do this, create a Go workspace file that modifies the source of Hugo's modules, source the workspace file, and start the local server.
139-
140-
For example:
141-
142-
1. Create a `hugo.work` file in root of this project.
143-
144-
1. Add the following config information to the `hugo.work` file:
145-
146-
```go
147-
go 1.22
148-
149-
use .
150-
use ../path/to/local/chef-docs-theme
151-
```
152-
153-
1. Start the Hugo local server:
154-
155-
```sh
156-
make test_theme
157-
```
158-
159-
This command adds the `hugo.work` file to the Hugo workspace and then ignores the contents of `chef-docs-theme` repo in the `_vendor` directory.
160-
161-
### Test theme branch
162-
163-
You can target a Git commit, branch, or tag when importing a module. This allows you to push a test branch up to `chef/chef-docs-theme` and then import it into this repository for local testing.
164-
165-
For example:
166-
167-
```sh
168-
hugo mod get -u github.com/chef/chef-docs-theme@<GIT_COMMIT_SHA>
169-
```
170-
171-
or
172-
173-
```sh
174-
hugo mod get -u github.com/chef/chef-docs-theme@<GIT_BRANCH>
175-
```
176-
177-
### Update theme
178-
179-
Run `make update_theme` to update the chef-docs-theme to the latest commit. This updates the theme and the theme's node dependencies.
180-
181113
## Build and preview the docs
182114

183115
You can preview documentation using one of the following:
@@ -192,6 +124,7 @@ This is automatic for members of the Chef GitHub organization; the Documentation
192124

193125
### Build and preview the docs locally
194126

127+
- [Install the site dependencies](#local-development-environment).
195128
- Run `make serve`
196129
- go to [http://localhost:1313](http://localhost:1313)
197130

@@ -202,7 +135,7 @@ This is useful for previewing redirects configured in the `netlify.toml` file.
202135

203136
Requirements:
204137

205-
- all the requirements for building this site locally
138+
- [all the requirements for building this site locally](#local-development-environment)
206139
- [Netlify CLI](https://docs.netlify.com/cli/get-started/#installation)
207140

208141
Run `netlify dev` to preview the site using the Netlify CLI.
@@ -214,89 +147,74 @@ Run `netlify dev` to preview the site using the Netlify CLI.
214147
Some Chef documentation is stored in private repositories so this option is only
215148
available to Progress Chef employees.
216149

217-
## Hugo vendoring
150+
## Update documentation from other repositories
218151

219-
[Vendoring](https://gohugo.io/commands/hugo_mod_vendor/) stores all of the module content
220-
from other repositories in the `_vendor` directory at the commit specified by
221-
the `go.mod` file. When Hugo builds the documentation, it will grab content from
222-
the `_vendor` directory instead of the original repository OR a local copy of a
223-
that repository. To see which commits the vendored files reference, see the
224-
`_vendor/modules.txt` file.
152+
We [vendor](https://gohugo.io/commands/hugo_mod_vendor/) most documentation, some Javascript dependencies, and our site theme in the `_vendor` directory.
225153

226-
To vendor the modules in chef-web-docs, run `hugo mod vendor`.
154+
### Update vendored content
227155

228-
To update the vendored modules, first update the [Hugo module(s)](#update-hugo-modules),
229-
then run `hugo mod vendor`.
156+
To updated vendored content, follow these steps:
230157

231-
To ignore the vendored files in a Hugo build, run `make serve_ignore_vendor`. This
232-
is the same as `make serve` except it adds the `--ignoreVendor` flag. This will
233-
build the documentation from the GitHub repositories or from a local copy of a repository
234-
if the `go.mod` file specifies pulling content from a local repository. (see above)
158+
1. Update the content from source repository using [`hugo mod get`](https://gohugo.io/commands/hugo_mod_get/). See the list of modules in the [`go.mod` file](https://github.com/chef/chef-web-docs/blob/main/go.mod) or the [module config file](https://github.com/chef/chef-web-docs/blob/main/config/_default/module.toml).
235159

236-
### Update Hugo modules
160+
To update content to the latest commit in the main branch:
237161

238-
Hugo modules are pinned to a particular commit of the master branch in their repository.
239-
If you look in the `go.mod` and `go.sum` files, you'll notice that each repository
240-
specifies a git commit timestamp and SHA.
162+
```sh
163+
hugo mod get -u github.com/<ORG>/<REPO>/<SUBDIRECTORY>
164+
```
241165

242-
To update a particular repo, run:
166+
You can also update a module to a particular Git SHA, branch, or tag. For example:
243167

244-
```bash
245-
hugo mod get github.com/chef/repo_to_update/subdirectory
246-
hugo mod clean
247-
```
168+
```sh
169+
hugo mod get -u github.com/<ORG>/<REPO>/<SUBDIRECTORY>@<GIT_SHA>
170+
```
248171

249-
Then [vendor](#hugo-vendoring) the documentation:
172+
1. Update the vendored content.
250173

251-
```bash
252-
hugo mod vendor
253-
```
174+
```sh
175+
rm -rf _vendor
176+
hugo mod tidy
177+
hugo mod vendor
178+
```
254179

255180
For example, to update the chef-workstation repository:
256181

257182
```bash
258-
hugo mod get github.com/chef/chef-workstation/docs-chef-io
259-
hugo mod clean
183+
hugo mod get -u github.com/chef/chef-workstation/docs-chef-io
184+
rm -rf _vendor
185+
hugo mod tidy
260186
hugo mod vendor
261187
```
262188

263189
This will update that repository to the most recent commit.
264190

265-
You can also update a module to a commit version number. For example:
191+
You can also update a module to a repository tag. For example:
266192

267193
```sh
268194
hugo mod get github.com/chef/chef-workstation/[email protected]
269-
hugo mod clean
195+
rm -rf _vendor
196+
hugo mod tidy
270197
hugo mod vendor
271198
```
272199

273200
And you can update a module to a Git commit. For example:
274201

275202
```sh
276203
hugo mod get github.com/chef/chef-workstation/docs-chef-io@0ad84dd5fa8
277-
hugo mod clean
204+
rm -rf _vendor
205+
hugo mod tidy
278206
hugo mod vendor
279207
```
280208

281-
The `hugo mod clean` command removes references to commits in the
282-
`go.mod` and `go.sum` files that are no longer relevant.
283-
284-
See Hugo's [documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules)
285-
for additional information about updating Hugo Modules.
286-
287-
### Update chef-docs-theme module
288-
289-
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
290-
291-
Run `make update_theme` to update the theme module and Node package dependencies.
209+
See [Hugo's documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules) for additional information about updating Hugo Modules.
292210
293211
### What if Hugo doesn't update a module
294212

295213
Sometimes Hugo and Git are a bit difficult and won't update a module cleanly or will leave
296214
references to older commits of a module in the `go.sum` file.
297215
298216
If you get an error indicating that Git can't find a repository that's already
299-
added as a module, try restarting your computer.
217+
added as a module, try cleaning your Hugo cache using `hugo mod clean`, and if that doesn't work, restart your computer.
300218

301219
If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
302220

@@ -313,6 +231,82 @@ If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
313231
and `go.sum` files, but it can't hurt either.
314232
1. Vendor the modules in chef-web-docs, `hugo mod vendor`.
315233

234+
## Docs site theme
235+
236+
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
237+
238+
### Update theme
239+
240+
Run `make update_theme` to update the site theme.
241+
242+
### Update theme Javascript dependencies
243+
244+
We source Javascript dependencies in the chef/chef-docs-theme repository using Node and GitHub.
245+
246+
#### Node dependencies
247+
248+
To update first-level Node dependencies:
249+
250+
1. Update the dependency in the [chef/chef-docs-theme package.hugo.json file](https://github.com/chef/chef-docs-theme/blob/main/package.hugo.json).
251+
2. Update the [package.json file in chef/chef-docs-theme](https://github.com/chef/chef-docs-theme/blob/main/package.json) by running `hugo mod npm pack`
252+
3. Commit the package file updates to main in chef/chef-docs-theme.
253+
4. Update the theme in this repo by running `make update_theme`.
254+
255+
To update transitive Node dependencies in this repo:
256+
257+
- Run `npm update`.
258+
259+
#### Javascript dependencies imported with Hugo
260+
261+
We use Hugo to import JavaScript dependencies from GitHub repositories. You can see the full list in either the chef/chef-docs-theme [go.mod file](https://github.com/chef/chef-docs-theme/blob/main/go.mod) or the [`hugo.toml` file](https://github.com/chef/chef-docs-theme/blob/main/hugo.toml).
262+
263+
To update these dependencies, follow these steps:
264+
265+
1. Update the dependency in the go.mod file in chef/chef-docs-theme using the [`hugo mod get -u` command](https://gohugo.io/commands/hugo_mod_get/).
266+
2. Tidy the go.sum file with `hugo mod tidy`.
267+
3. Commit the changes to chef/chef-docs-theme
268+
4. Update the theme contents in this repo with `make update_theme`.
269+
270+
### Local theme testing
271+
272+
You can test local changes made to the chef-docs-theme repository and preview those changes using Hugo's local development server.
273+
To do this, create a Go workspace file that modifies the source of Hugo's modules, source the workspace file, and start the local server.
274+
275+
For example:
276+
277+
1. Create a `hugo.work` file in root of this project.
278+
279+
1. Add the following config information to the `hugo.work` file:
280+
281+
```go
282+
go 1.22
283+
284+
use .
285+
use ../path/to/local/chef-docs-theme
286+
```
287+
288+
1. Start the Hugo local server:
289+
290+
```sh
291+
make test_theme
292+
```
293+
294+
This command adds the `hugo.work` file to the Hugo workspace and then ignores the contents of `chef-docs-theme` repo in the `_vendor` directory.
295+
296+
## Edit on GitHub links
297+
298+
We use a partial `edit_on_github.html` to add "Edit on GitHub" links to each page.
299+
300+
Each page should have a `gh_repo` parameter set to the value of the GitHub repository
301+
that the page comes from. For example, `gh_repo = "chef-server"`
302+
303+
Each repository with documentation has a `config.toml` file with a `params.<REPOSITORY>`
304+
map and a `gh_path` parameter set to the path of the docs content directory in
305+
that repository.
306+
307+
The `edit_on_github` partial appends the page file name to the end of `gh_path`
308+
parameter and adds the link to the text of the page.
309+
316310
## Release notes
317311

318312
Release notes are added to release notes pages using Hugo's [`resource.getRemote` function](https://gohugo.io/hugo-pipes/introduction/#get-resource-with-resourcesget-and-resourcesgetremote) and content from [https://omnitruck.chef](omnitruck.chef.io) and [https://packages.chef.io](packages.chef.io).
@@ -361,7 +355,7 @@ The commit history of this repo before February 12, 2016 has been archived to th
361355
We love getting feedback. You can use:
362356

363357
- Each page has a feedback form at the bottom of the page.
364-
- Email --- Send an email to chef-docs@progress.com for documentation bugs,
358+
- Email --- Send an email to <[email protected]> for documentation bugs,
365359
ideas, thoughts, and suggestions. This email address isn't a
366360
support email address, however. If you need support, contact Chef
367361
support.

_vendor/github.com/chef/automate/components/docs-chef-io/content/automate/backup.md

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)