Created
March 17, 2017 04:56
-
-
Save waltervargas/a0a0e7e1c1e3396834c5b960c542c559 to your computer and use it in GitHub Desktop.
Packer Build Script for Jenkins Job AWS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd packer/jenkins | |
if [ ! -f bin/packer ]; then | |
wget -c https://releases.hashicorp.com/packer/0.12.3/packer_0.12.3_linux_amd64.zip | |
unzip -d bin packer_0.12.3_linux_amd64.zip | |
fi | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
git_url=$(git config --get remote.origin.url) | |
tmpl=$(git rev-parse --show-prefix) | |
tmpl+=jenkins.json | |
echo "Building $tmpl" | |
bin/packer build -color=false -var 'env=dev' -var "branch=$branch" -var "aws_region=$region" -var "vpc_id=$vpc" -var "subnet_id=$subnet" -var "git_url=$git_url" -var "tmpl=$tmpl" jenkins.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment