packer-cn/website/source/docs/templates/push.html.md

94 lines
2.6 KiB
Markdown
Raw Normal View History

2014-12-09 17:55:17 -05:00
---
2017-06-14 21:04:16 -04:00
description: |
Within the template, the push section configures how a template can be pushed
to a remote build service.
2015-07-22 22:31:00 -04:00
layout: docs
2017-06-14 21:04:16 -04:00
page_title: 'Push - Templates'
sidebar_current: 'docs-templates-push'
---
2014-12-09 17:55:17 -05:00
# Template Push
2014-12-09 17:55:17 -05:00
Within the template, the push section configures how a template can be
[pushed](/docs/commands/push.html) to a remote build service.
2014-12-09 17:55:17 -05:00
2015-07-22 22:31:00 -04:00
Push configuration is responsible for defining what files are required to build
this template, what the name of build configuration is in the build service,
etc.
2014-12-09 17:55:17 -05:00
The only build service that Packer can currently push to is
[Atlas](https://atlas.hashicorp.com) by HashiCorp. Support for other build
services will come in the form of plugins in the future.
Within a template, a push configuration section looks like this:
2017-06-14 21:04:16 -04:00
``` json
2014-12-09 17:55:17 -05:00
{
"push": {
// ... push configuration here
}
}
```
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
### Required
2017-06-14 21:04:16 -04:00
- `name` (string) - Name of the build configuration in the build service. If
this doesn't exist, it will be created (by default). Note that the name
cannot contain dots. `[a-zA-Z0-9-_/]+` are safe.
2014-12-09 17:55:17 -05:00
### Optional
2017-06-14 21:04:16 -04:00
- `address` (string) - The address of the build service to use. By default
2015-07-22 23:25:58 -04:00
this is `https://atlas.hashicorp.com`.
2014-12-09 17:55:17 -05:00
2017-06-14 21:04:16 -04:00
- `base_dir` (string) - The base directory of the files to upload. This will
2015-07-22 23:25:58 -04:00
be the current working directory when the build service executes
your template. This path is relative to the template.
2014-12-09 17:55:17 -05:00
2017-06-14 21:04:16 -04:00
- `include` (array of strings) - Glob patterns to include relative to the
2015-07-22 23:25:58 -04:00
`base_dir`. If this is specified, only files that match the include pattern
are included.
2014-12-09 17:55:17 -05:00
2017-06-14 21:04:16 -04:00
- `exclude` (array of strings) - Glob patterns to exclude relative to the
2015-07-22 23:25:58 -04:00
`base_dir`.
2014-12-09 17:55:17 -05:00
2017-06-14 21:04:16 -04:00
- `token` (string) - An access token to use to authenticate to the
2015-07-22 23:25:58 -04:00
build service.
2014-12-09 17:55:17 -05:00
2017-06-14 21:04:16 -04:00
- `vcs` (boolean) - If true, Packer will detect your VCS (if there is one) and
2015-07-22 23:25:58 -04:00
only upload the files that are tracked by the VCS. This is useful for
automatically excluding ignored files. This defaults to false.
## Examples
A push configuration section with minimal options:
2017-06-14 21:04:16 -04:00
``` json
{
"push": {
"name": "hashicorp/precise64"
}
}
```
A push configuration specifying Packer to inspect the VCS and list individual
files to include:
2017-06-14 21:04:16 -04:00
``` json
{
"push": {
"name": "hashicorp/precise64",
"vcs": true,
"include": [
"other_file/outside_of.vcs"
]
}
}
```