-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add entry in PR description asking Pull Requesters to document any new commands they add #2688
Open
moskyb
wants to merge
1
commit into
main
Choose a base branch
from
pr-description-write-your-own-damn-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- This doc is copied from the Buildkite engineering handbook, and is copied here so that it can be consumed by the public --> | ||
|
||
# Updating Agent Docs | ||
|
||
The public documentation for the agent is hosted at https://buildkite.com/docs/agent/v3. The source code is in https://github.com/buildkite/docs. This document is our guide on how to update the public docs as we develop the agent. | ||
|
||
## New sub command | ||
|
||
Creating a new sub command for the agent requires touching a few different files. In this example, our new sub command will be called `foo` and will be invoked as | ||
|
||
``` | ||
buildkite-agent foo | ||
``` | ||
|
||
The page for the sub command will be served at `/docs/agent/v3/cli-foo` | ||
|
||
### Create ERB template | ||
|
||
This will be at `pages/agent/v3/cli_foo.md.erb`. The template only contains some sections of the sub command, the rest is generated as a markdown file | ||
|
||
### Add sub command to generation script | ||
|
||
The script is: | ||
|
||
``` | ||
scripts/update-agent-help.sh | ||
``` | ||
|
||
There is a bash array called `commands` within it. You will need to add the sub command (i.e. foo) to it. | ||
|
||
### Generate markdown | ||
|
||
You will need to create an empty file in the right location and then execute the script. | ||
|
||
``` | ||
touch pages/agent/v3/help/_foo.md | ||
scripts/update-agent-help.sh | ||
``` | ||
|
||
### Add to Usage section | ||
|
||
In the file `pages/agent/v3.md.erb`, there is a H2 called "Usage" (i.e. ## Usage) | ||
Under the text "Available commands are:", there are some anchors. The section is intended to represent the output of `buildkite-agent --help`. You will need to add an links to the sub command here: | ||
|
||
``` | ||
<a href="/docs/agent/v3/cli-foo">foo</a> Description of foo that is in the help text | ||
``` | ||
|
||
As well as using the exact same description of `foo` that is in the help text, you MUST ensure that the number of spaces between the closing anchor tag an the start of the description allows the correct alignment of the start of the description for foo with those of the other commands. See https://buildkite.com/docs/agent/v3#usage for what this currently looks like. You should view docs served locally or on Render to iterate on this. | ||
|
||
### Add to nav bar | ||
|
||
We need to add the yaml object | ||
|
||
``` | ||
- name: 'foo' | ||
path: 'agent/v3/cli-foo' | ||
``` | ||
|
||
To the children of an object with the name `Command-line reference` in the file `data/nav.yml`. | ||
|
||
### Example | ||
|
||
Here is an example of a PR that added a sub command and little else: https://github.com/buildkite/docs/pull/1742 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs repo is public too yeah? I think this document belongs there as most of the commands assume the working directory is a docs repo.
I suggested putting it in an agent section in the README as there is no
docs
directory in thedocs
repo for documentation on the documentation! You could create one if you want. I think it's a good precedent to set.