clarify onlyexcept docs further (#10679)

This commit is contained in:
Megan Marsh 2021-03-01 02:45:58 -08:00 committed by GitHub
parent eea215adf9
commit 751038cd6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 20 deletions

View File

@ -33,12 +33,20 @@ Errors validating build 'vmware'. 1 error(s) occurred:
configuration is not validated.
- `-except=foo,bar,baz` - Validates all the builds except those with the
comma-separated names. Build names by default are the names of their
builders, unless a specific `name` attribute is specified within the configuration.
comma-separated names. In legacy JSON templates, build names default to the
types of their builders (e.g. `docker` or
`amazon-ebs` or `virtualbox-iso`, unless a specific `name` attribute is
specified within the configuration. In HCL2 templates, the "name" is the
source block's "name" label, unless an in-build source definition adds the
"name" configuration option.
- `-only=foo,bar,baz` - Only validate the builds with the given comma-separated
names. Build names by default are the names of their builders, unless a
specific `name` attribute is specified within the configuration.
names. In legacy JSON templates, build names default to the
types of their builders (e.g. `docker` or
`amazon-ebs` or `virtualbox-iso`, unless a specific `name` attribute is
specified within the configuration. In HCL2 templates, the "name" is the
source block's "name" label, unless an in-build source definition adds the
"name" configuration option.
- `-machine-readable` Sets all output to become machine-readable on stdout.
Logging, if enabled, continues to appear on stderr.

View File

@ -25,9 +25,10 @@ build {
sources [
"source.amazon-ebs.first-example",
]
source "source.amazon-ebs.second-example" {
// setting the name field allows to rename the source only for this build
// section.
source "source.amazon-ebs.second-example"
// setting the name field allows you to rename the source only for this
// build section. To match this builder, you need to use
// second-example-local-name, not second-example
name = "second-example-local-name"
}
@ -68,4 +69,4 @@ configuration:
-> Note: In the cli `only` and `except` will match agains **build names** (for
example:`my_build.amazon-ebs.first-example`) but in a provisioner they will
match on the **source type** (for example:`source.amazon-ebs.third-example`).
match on the **source name** (for example:`amazon-ebs.third-example`).

View File

@ -169,7 +169,8 @@ option _ignores_ post-processors.
])
```
The values within `only` or `except` are _build names_, not builder types. If
you recall, build names by default are just their builder type, but if you
specify a custom `name` parameter, then you should use that as the value
instead of the type.
The values within `only` or `except` are _build names_, not builder types.
Name is a required block label in HCL, but in legacy JSON, build names default
to the types of their builders (e.g. `docker` or `amazon-ebs` or
`virtualbox-iso`, unless a specific `name` attribute is specified within the
configuration.

View File

@ -1,7 +1,10 @@
- `-except=foo,bar,baz` - Run all the builds and post-processors except those
with the given comma-separated names. Build and post-processor names by
default are their type, unless a specific `name` attribute is specified
within the configuration. Any post-processor following a skipped
post-processor will not run. Because post-processors can be nested in
arrays a different post-processor chain can still run. A post-processor
with the given comma-separated names. In legacy JSON templates, build names default to the
types of their builders (e.g. `docker` or
`amazon-ebs` or `virtualbox-iso`, unless a specific `name` attribute is
specified within the configuration. In HCL2 templates, the "name" is the
source block's "name" label, unless an in-build source definition adds the
"name" configuration option.Any post-processor following
a skipped post-processor will not run. Because post-processors can be nested
in arrays a different post-processor chain can still run. A post-processor
with an empty name will be ignored.

View File

@ -1,4 +1,7 @@
- `-only=foo,bar,baz` - Only run the builds with the given comma-separated
names. Build names by default are their type, unless a specific `name`
attribute is specified within the configuration. `-only` does not apply to
post-processors.
names. In legacy JSON templates, build names default to the
types of their builders (e.g. `docker` or
`amazon-ebs` or `virtualbox-iso`, unless a specific `name` attribute is
specified within the configuration. In HCL2 templates, the "name" is the
source block's "name" label, unless an in-build source definition adds the
"name" configuration option.