A Jenkins plugin to poll for new AMIs and trigger a build for the latest matching AMI.
This plugin uses the AWS EC2 DecribeImages service to find matching AMIs.
The following filters are supported:
name- The name of the AMI (provided during image creation - supports wildcards)description- The description of the image (provided during image creation - supports wildcards)tags(key=value) - The key/value combination of a tag assigned to the resource
The following advanced filters are also supported:
architecture- the image architecture (i386|x86_64)is-public- a boolean that indicates whether the image is publicowner-alias- string value from an Amazon-maintained list (amazon|aws-marketplace|microsoft) of snapshot ownersowner-id- the AWS account ID of the image ownerproduct-code- the product code
(Note that state is always set to available).
The filters are configured on the build configuration page:
This has the following fields:
- Schedule - a cron style schedule for the trigger
- Amazon EC2 Credentials - the id of credentials added via the AWS Credentials Plugin
- Amazon EC2 Region Name - the region name to search for AMIs (defaults to
us-east-1) - Name - the name of the AMI
- Description - the description of the AMI
- Tags - tags for the AMI in the form
key=value[;key=value], for exampleProject=Awesome;Role=Web
Note that at least one of Name, Description or Tags must be specified to prevent the filter fetching too many AMIs.
Advanced filters may also be specified:
- Architecture - the image architecture (
i386|x86_64) - Owner Alias - value from an Amazon-maintained list (
amazon|aws-marketplace|microsoft) of snapshot owners - Owner Id - the AWS account ID of the image owner
- Product Code - the product code
- Public - a boolean that indicates whether the image is public
Click Test Filter to test the filter before saving. This displays the number of AMIs currently matching the filter and the top 10
latest matches. It displays the following attributes of those images: creation-date, image-id, name and description.
Click Add to add more filters.
For each build that is triggered, the following environment variable indicates how many of the filters triggered:
awsAmiTriggerCount- count of the number of filters that triggered
For each filter that triggered, the following image related environment variables are available to the build:
awsAmiTriggerImageArchitecture1- the image architecture (i386|x86_64)awsAmiTriggerImageCreationDate1- the date and time the image was createdawsAmiTriggerImageDescription1- the description of the AMI that was provided during image creationawsAmiTriggerImageHypervisor1- the hypervisor type of the image (ovm|xen)awsAmiTriggerImageId1- the ID of the AMIawsAmiTriggerImageType1- the type of image (machine|kernel|ramdisk)awsAmiTriggerImageName1- the name of the AMI that was provided during image creationawsAmiTriggerOwnerAlias1- the AWS account alias (for example, amazon, self) or the AWS account ID of the AMI ownerawsAmiTriggerOwnerId1- the AWS account ID of the image ownerawsAmiTriggerImageProductCodes1- Any product codes associated with the AMIawsAmiTriggerImageTags1- Any tags assigned to the imageawsAmiTriggerImageIsPublic1- Indicates whether the image has public launch permissions
Also, the values of the triggered filter are available as:
awsAmiTriggerFilterArchitecture1awsAmiTriggerFilterDescription1awsAmiTriggerFilterName1awsAmiTriggerFilterOwnerAlias1awsAmiTriggerFilterOwnerId1awsAmiTriggerFilterProductCode1awsAmiTriggerFilterTags1awsAmiTriggerFilterIsPublic1
No variables are set for filters that did not match any new AMIs.


