hello maybe the | tee build.log is causing issues.
if you want error to cross over pipes, you may want to read about pipefail. ie: kikitux@alvaro MINGW64 ~ $ true | tee a.log ; echo $? 0 kikitux@alvaro MINGW64 ~ $ false | tee a.log ; echo $? 0 kikitux@alvaro MINGW64 ~ $ set -o pipefail kikitux@alvaro MINGW64 ~ $ true | tee a.log ; echo $? 0 kikitux@alvaro MINGW64 ~ $ false | tee a.log ; echo $? 1 <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virusvrij. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On Fri, Oct 20, 2017 at 1:13 PM, <[email protected]> wrote: > Hi, > > As part of our packer script, we install some deb packages into an ubuntu > instance as well into a chroot environment on that instance. This works > well, but we recently had a problem with one dependency not installing well > and us not seeing an error from packer. > > Our packer json looks something like this: > > "sudo pip install awscli", > "sudo /usr/sbin/chroot --userspec=root:root /linoxide > add-apt-repository ppa:webupd8team/java -y", > "sudo /usr/sbin/chroot --userspec=root:root /linoxide apt-get update" > , > "sudo /usr/sbin/chroot --userspec=root:root /linoxide apt-get -y > install oracle-java8-installer", > > There was/is an issue with the java package and the last apt-get install > fails due to a 404 error. Packer continues with generating the amis for the > other regions. > > This is how we call packer build: > packer build -machine-readable -var version=${VERSION} ./packer/xxxx.json > | tee build.log > result=$? > if [ ! $result = "0" ]; then > echo "AMI creation failed!" > exit $result > fi > > How can bubble up the installation error to jenkins to trigger a build > fail? > > Many thanks, > > Robert > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/fcea53c0-2487-4325-908c-dcdef1459980%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/fcea53c0-2487-4325-908c-dcdef1459980%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Alvaro -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAHqq0eyTTYuFVjXVxGXecvnAJ8Dkw8KPBUranioWcy1kXyn86w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
