Skip to content

Commit ace27c4

Browse files
authored
Merge pull request #2317 from buildkite/pdp-1505-adjust-the-buildkite-agent-help-text-to-work-with-the-new
2 parents 8f07ffa + 014526f commit ace27c4

28 files changed

+392
-379
lines changed

clicommand/acknowledgements.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ import (
1010
)
1111

1212
const acknowledgementsHelpDescription = `Usage:
13-
buildkite-agent acknowledgements
13+
14+
buildkite-agent acknowledgements
1415
1516
Description:
16-
Prints the licenses and notices of open source software incorporated into
17-
this software.
17+
18+
Prints the licenses and notices of open source software incorporated into
19+
this software.
1820
1921
Example:
2022
21-
$ buildkite-agent acknowledgements`
23+
$ buildkite-agent acknowledgements`
2224

2325
//go:embed *.md.gz
2426
var files embed.FS

clicommand/agent_start.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ import (
3939

4040
const startDescription = `Usage:
4141
42-
buildkite-agent start [options...]
42+
buildkite-agent start [options...]
4343
4444
Description:
4545
46-
When a job is ready to run it will call the "bootstrap-script"
47-
and pass it all the environment variables required for the job to run.
48-
This script is responsible for checking out the code, and running the
49-
actual build script defined in the pipeline.
46+
When a job is ready to run it will call the "bootstrap-script"
47+
and pass it all the environment variables required for the job to run.
48+
This script is responsible for checking out the code, and running the
49+
actual build script defined in the pipeline.
5050
51-
The agent will run any jobs within a PTY (pseudo terminal) if available.
51+
The agent will run any jobs within a PTY (pseudo terminal) if available.
5252
5353
Example:
5454
55-
$ buildkite-agent start --token xxx`
55+
$ buildkite-agent start --token xxx`
5656

5757
var verificationFailureBehaviors = []string{agent.VerificationBehaviourBlock, agent.VerificationBehaviourWarn}
5858

clicommand/annotate.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,37 @@ const (
2121

2222
const annotateHelpDescription = `Usage:
2323
24-
buildkite-agent annotate [body] [options...]
24+
buildkite-agent annotate [body] [options...]
2525
2626
Description:
2727
28-
Build annotations allow you to customize the Buildkite build interface to
29-
show information that may surface from your builds. Some examples include:
28+
Build annotations allow you to customize the Buildkite build interface to
29+
show information that may surface from your builds. Some examples include:
3030
31-
- Links to artifacts generated by your jobs
32-
- Test result summaries
33-
- Graphs that include analysis about your codebase
34-
- Helpful information for team members about what happened during a build
31+
- Links to artifacts generated by your jobs
32+
- Test result summaries
33+
- Graphs that include analysis about your codebase
34+
- Helpful information for team members about what happened during a build
3535
36-
Annotations are written in CommonMark-compliant Markdown, with "GitHub
37-
Flavored Markdown" extensions.
36+
Annotations are written in CommonMark-compliant Markdown, with "GitHub
37+
Flavored Markdown" extensions.
3838
39-
The annotation body can be supplied as a command line argument, or by piping
40-
content into the command. The maximum size of each annotation body is 1MiB.
39+
The annotation body can be supplied as a command line argument, or by piping
40+
content into the command. The maximum size of each annotation body is 1MiB.
4141
42-
You can update an existing annotation's body by running the annotate command
43-
again and provide the same context as the one you want to update. Or if you
44-
leave context blank, it will use the default context.
42+
You can update an existing annotation's body by running the annotate command
43+
again and provide the same context as the one you want to update. Or if you
44+
leave context blank, it will use the default context.
4545
46-
You can also update only the style of an existing annotation by omitting the
47-
body entirely and providing a new style value.
46+
You can also update only the style of an existing annotation by omitting the
47+
body entirely and providing a new style value.
4848
4949
Example:
5050
51-
$ buildkite-agent annotate "All tests passed! :rocket:"
52-
$ cat annotation.md | buildkite-agent annotate --style "warning"
53-
$ buildkite-agent annotate --style "success" --context "junit"
54-
$ ./script/dynamic_annotation_generator | buildkite-agent annotate --style "success"`
51+
$ buildkite-agent annotate "All tests passed! :rocket:"
52+
$ cat annotation.md | buildkite-agent annotate --style "warning"
53+
$ buildkite-agent annotate --style "success" --context "junit"
54+
$ ./script/dynamic_annotation_generator | buildkite-agent annotate --style "success"`
5555

5656
type AnnotateConfig struct {
5757
Body string `cli:"arg:0" label:"annotation body"`

clicommand/annotation_remove.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ import (
1111

1212
const annotationRemoveHelpDescription = `Usage:
1313
14-
buildkite-agent annotation remove [arguments...]
14+
buildkite-agent annotation remove [arguments...]
1515
1616
Description:
1717
18-
Remove an existing annotation which was previously published using the
19-
buildkite-agent annotate command.
18+
Remove an existing annotation which was previously published using the
19+
buildkite-agent annotate command.
2020
21-
If you leave context blank, it will use the default context.
21+
If you leave context blank, it will use the default context.
2222
2323
Example:
2424
25-
$ buildkite-agent annotation remove
26-
$ buildkite-agent annotation remove --context "remove-me"`
25+
$ buildkite-agent annotation remove
26+
$ buildkite-agent annotation remove --context "remove-me"`
2727

2828
type AnnotationRemoveConfig struct {
2929
Context string `cli:"context" validate:"required"`

clicommand/artifact_download.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@ import (
1010

1111
const downloadHelpDescription = `Usage:
1212
13-
buildkite-agent artifact download [options] <query> <destination>
13+
buildkite-agent artifact download [options] <query> <destination>
1414
1515
Description:
1616
17-
Downloads artifacts matching <query> from Buildkite to <destination>
18-
directory on the local machine.
17+
Downloads artifacts matching <query> from Buildkite to <destination>
18+
directory on the local machine.
1919
20-
Note: You need to ensure that your search query is surrounded by quotes if
21-
using a wild card as the built-in shell path globbing will expand the wild
22-
card and break the query.
20+
Note: You need to ensure that your search query is surrounded by quotes if
21+
using a wild card as the built-in shell path globbing will expand the wild
22+
card and break the query.
2323
24-
If the last path component of <destination> matches the first path component
25-
of your <query>, the last component of <destination> is dropped from the
26-
final path. For example, a query of 'app/logs/*' with a destination of
27-
'foo/app' will write any matched artifact files to 'foo/app/logs/', relative
28-
to the current working directory.
24+
If the last path component of <destination> matches the first path component
25+
of your <query>, the last component of <destination> is dropped from the
26+
final path. For example, a query of 'app/logs/*' with a destination of
27+
'foo/app' will write any matched artifact files to 'foo/app/logs/', relative
28+
to the current working directory.
2929
30-
You can also change working directory to the intended destination and use a
31-
<destination> of '.' to always create a directory hierarchy matching the
32-
artifact paths.
30+
You can also change working directory to the intended destination and use a
31+
<destination> of '.' to always create a directory hierarchy matching the
32+
artifact paths.
3333
3434
Example:
3535
36-
$ buildkite-agent artifact download "pkg/*.tar.gz" . --build xxx
36+
$ buildkite-agent artifact download "pkg/*.tar.gz" . --build xxx
3737
38-
This will search across all the artifacts for the build with files that match that part.
39-
The first argument is the search query, and the second argument is the download destination.
38+
This will search across all the artifacts for the build with files that match that part.
39+
The first argument is the search query, and the second argument is the download destination.
4040
41-
If you're trying to download a specific file, and there are multiple artifacts from different
42-
jobs, you can target the particular job you want to download the artifact from:
41+
If you're trying to download a specific file, and there are multiple artifacts from different
42+
jobs, you can target the particular job you want to download the artifact from:
4343
44-
$ buildkite-agent artifact download "pkg/*.tar.gz" . --step "tests" --build xxx
44+
$ buildkite-agent artifact download "pkg/*.tar.gz" . --step "tests" --build xxx
4545
46-
You can also use the step's jobs id (provided by the environment variable $BUILDKITE_JOB_ID)`
46+
You can also use the step's jobs id (provided by the environment variable $BUILDKITE_JOB_ID)`
4747

4848
type ArtifactDownloadConfig struct {
4949
Query string `cli:"arg:0" label:"artifact search query" validate:"required"`

clicommand/artifact_search.go

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,57 @@ import (
1414

1515
const searchHelpDescription = `Usage:
1616
17-
buildkite-agent artifact search [options] <query>
17+
buildkite-agent artifact search [options] <query>
1818
1919
Description:
2020
21-
Searches for build artifacts specified by <query> on Buildkite
21+
Searches for build artifacts specified by <query> on Buildkite
2222
23-
Note: You need to ensure that your search query is surrounded by quotes if
24-
using a wild card as the built-in shell path globbing will provide files,
25-
which will break the search.
23+
Note: You need to ensure that your search query is surrounded by quotes if
24+
using a wild card as the built-in shell path globbing will provide files,
25+
which will break the search.
2626
2727
Example:
2828
29-
$ buildkite-agent artifact search "pkg/*.tar.gz" --build xxx
29+
$ buildkite-agent artifact search "pkg/*.tar.gz" --build xxx
3030
31-
This will search across all uploaded artifacts in a build for files that match that query.
32-
The first argument is the search query.
31+
This will search across all uploaded artifacts in a build for files that match that query.
32+
The first argument is the search query.
3333
34-
If you're trying to find a specific file, and there are multiple artifacts from different
35-
jobs, you can target the particular job you want to search the artifacts from using --step:
34+
If you're trying to find a specific file, and there are multiple artifacts from different
35+
jobs, you can target the particular job you want to search the artifacts from using --step:
3636
37-
$ buildkite-agent artifact search "pkg/*.tar.gz" --step "tests" --build xxx
37+
$ buildkite-agent artifact search "pkg/*.tar.gz" --step "tests" --build xxx
3838
39-
You can also use the step's job id (provided by the environment variable $BUILDKITE_JOB_ID)
39+
You can also use the step's job id (provided by the environment variable $BUILDKITE_JOB_ID)
4040
41-
Output formatting can be altered with the -format flag as follows:
41+
Output formatting can be altered with the -format flag as follows:
4242
43-
$ buildkite-agent artifact search "*" -format "%p\n"
43+
$ buildkite-agent artifact search "*" -format "%p\n"
4444
45-
The above will return a list of filenames separated by newline.`
45+
The above will return a list of filenames separated by newline.`
46+
47+
const artifactSearchHelpTemplate = `{{.Description}}
48+
49+
Options:
50+
51+
{{range .VisibleFlags}} {{.}}
52+
{{end}}
53+
Format specifiers:
54+
55+
%i UUID of the artifact
56+
57+
%p Artifact path
58+
59+
%c Artifact creation time (an ISO 8601 / RFC-3339 formatted UTC timestamp)
60+
61+
%j UUID of the job that uploaded the artifact, helpful for subsequent artifact downloads
62+
63+
%s File size of the artifact in bytes
64+
65+
%S SHA1 checksum of the artifact
66+
67+
%u Download URL for the artifact, though consider using 'buildkite-agent artifact download' instead`
4668

4769
type ArtifactSearchConfig struct {
4870
Query string `cli:"arg:0" label:"artifact search query" validate:"required"`
@@ -67,32 +89,10 @@ type ArtifactSearchConfig struct {
6789
}
6890

6991
var ArtifactSearchCommand = cli.Command{
70-
Name: "search",
71-
Usage: "Searches artifacts in Buildkite",
72-
Description: searchHelpDescription,
73-
CustomHelpTemplate: `{{.Description}}
74-
75-
Options:
76-
77-
{{range .VisibleFlags}}{{.}}
78-
{{end}}
79-
80-
Format specifiers:
81-
82-
%i UUID of the artifact
83-
84-
%p Artifact path
85-
86-
%c Artifact creation time (an ISO 8601 / RFC-3339 formatted UTC timestamp)
87-
88-
%j UUID of the job that uploaded the artifact, helpful for subsequent artifact downloads
89-
90-
%s File size of the artifact in bytes
91-
92-
%S SHA1 checksum of the artifact
93-
94-
%u Download URL for the artifact, though consider using 'buildkite-agent artifact download' instead
95-
`,
92+
Name: "search",
93+
Usage: "Searches artifacts in Buildkite",
94+
Description: searchHelpDescription,
95+
CustomHelpTemplate: artifactSearchHelpTemplate,
9696
Flags: []cli.Flag{
9797
cli.StringFlag{
9898
Name: "step",

clicommand/artifact_shasum.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@ import (
1414

1515
const shasumHelpDescription = `Usage:
1616
17-
buildkite-agent artifact shasum [options...]
17+
buildkite-agent artifact shasum [options...]
1818
1919
Description:
2020
21-
Prints the SHA-1 or SHA-256 hash for the single artifact specified by a
22-
search query.
21+
Prints the SHA-1 or SHA-256 hash for the single artifact specified by a
22+
search query.
2323
24-
The hash is fetched from Buildkite's API, having been generated client-side
25-
by the agent during artifact upload.
24+
The hash is fetched from Buildkite's API, having been generated client-side
25+
by the agent during artifact upload.
2626
27-
A search query that does not match exactly one artifact results in an error.
27+
A search query that does not match exactly one artifact results in an error.
2828
29-
Note: You need to ensure that your search query is surrounded by quotes if
30-
using a wild card as the built-in shell path globbing will provide files,
31-
which will break the download.
29+
Note: You need to ensure that your search query is surrounded by quotes if
30+
using a wild card as the built-in shell path globbing will provide files,
31+
which will break the download.
3232
3333
Example:
3434
35-
$ buildkite-agent artifact shasum "pkg/release.tar.gz" --build xxx
35+
$ buildkite-agent artifact shasum "pkg/release.tar.gz" --build xxx
3636
37-
This will search for all files in the build with path "pkg/release.tar.gz",
38-
and if exactly one match is found, the SHA-1 hash generated during upload
39-
is printed.
37+
This will search for all files in the build with path "pkg/release.tar.gz",
38+
and if exactly one match is found, the SHA-1 hash generated during upload
39+
is printed.
4040
41-
If you would like to target artifacts from a specific build step, you can do
42-
so by using the --step argument.
41+
If you would like to target artifacts from a specific build step, you can do
42+
so by using the --step argument.
4343
44-
$ buildkite-agent artifact shasum "pkg/release.tar.gz" --step "release" --build xxx
44+
$ buildkite-agent artifact shasum "pkg/release.tar.gz" --step "release" --build xxx
4545
46-
You can also use the step's job ID (provided by the environment variable $BUILDKITE_JOB_ID)
46+
You can also use the step's job ID (provided by the environment variable $BUILDKITE_JOB_ID)
4747
48-
The --sha256 argument requests SHA-256 instead of SHA-1; this is only
49-
available for artifacts uploaded since SHA-256 support was added to the
50-
agent.`
48+
The --sha256 argument requests SHA-256 instead of SHA-1; this is only
49+
available for artifacts uploaded since SHA-256 support was added to the
50+
agent.`
5151

5252
type ArtifactShasumConfig struct {
5353
Query string `cli:"arg:0" label:"artifact search query" validate:"required"`

0 commit comments

Comments
 (0)