Skip to content

Instantly share code, notes, and snippets.

@nickrw
Created January 31, 2014 15:48
Show Gist options
  • Save nickrw/8734623 to your computer and use it in GitHub Desktop.
Save nickrw/8734623 to your computer and use it in GitHub Desktop.
#!/bin/bash
rdom () { local IFS=\> ; read -d \< E C ;}
base_ami=$(while rdom; do
if [[ $E = description ]]; then
if [[ $C =~ ^ami- ]]; then
echo $C
fi
fi
done < /var/lib/jenkins/jobs/packer-base/lastSuccessful/build.xml | head -n 1)
echo "Upstream AMI is: ${base_ami}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment