A Drone plugin to run packer builds.
pipeline:
build:
image: kayako/drone-packer
include_files: [ config/common.json, config/<target> ]
target: base.json
variables:
name: packer
version: 33
account: AWS account ID in which to assume the role. Instance IAM role will be used by defaultuse_ci_role: IAM role name to use. Defaults to ci. Ignored if account is not providedtarget: Name of target packer template to executevariables: Optional variables to pass to packer build commandsecret_variables: List of variables to be read from environmentinclude_files: List of variable files to include in buildexcept: List of builders to skiponly: List of builders to runtarget must be the name of the target template. target can be provided as plugin parameter
in .drone.yml file or it can be passed as deployment parameter using either drone CLI or
github deployment api.variables is optional and must be a flat dictionary. An intact JSON representation of the dictionary
will be passed to packer.include_files is an optional list of path to JSON files relative to build directory. It can contain
<target> literal string which will be replaced by actual target name as provided to the plugin.except and only, if provided, must be valid Yaml list types.secret_variables is an optional list of variable names that should be read from environment.
Make sure to whitelist the secrets in drone configuration fileFollowing configuration
pipeline:
build:
image: kayako/drone-packer
include_files: [ config/common.json, config/<target> ]
target: base.json
variables:
name: packer
version: 33
secret_variables: [ vpc_id, subnet_id ]
secrets: [ vpc_id, subnet_id ]
will create a temporary file build_variables.json containing the variables:
{
"name": "packer",
"version": 33
}
and run the command without line breaks.
packer build --var-file build_variables.json \
--var-file config/common.json \
--var-file config/base.json \
--var 'vpc_id=vpc-id-in-env' \
--var 'subnet_id=subnet-id-in-env' \
base.json
Content type
Image
Digest
Size
47.8 MB
Last updated
almost 9 years ago
docker pull kayako/drone-packer