Hello

this:

if [ ! $result = "0" ]; then

will be better as:

if [ ${result} -ne 0 ]; then

Alvaro



On Fri, Oct 20, 2017 at 1:48 PM, Robert Graebert <
[email protected]> wrote:

> Hi Alvaro,
>
> thanks for that pointer. We will try that and see if packer was behaving
> well and the pipe swalled the error.
>
> Robert
>
> On 20 October 2017 at 13:22, Alvaro Miranda Aguilera <[email protected]>
> wrote:
>
>> 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>
>> <#m_-2185226788277698172_m_7342254689388782780_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/ms
>>> gid/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 a topic in the
>> Google Groups "Packer" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/packer-tool/rwTS8quGyXc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/packer-tool/CAHqq0eyTTYuFVjXVxGXecvnAJ8Dkw8KPBUranioWcy1
>> kXyn86w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/packer-tool/CAHqq0eyTTYuFVjXVxGXecvnAJ8Dkw8KPBUranioWcy1kXyn86w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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/CADXtw9kK62e7BvC65YxnEuAsqX%3DckKw11sj04UeO68jH4MORhQ%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CADXtw9kK62e7BvC65YxnEuAsqX%3DckKw11sj04UeO68jH4MORhQ%40mail.gmail.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/CAHqq0ez6Ogpn5jS7aq9%3DB47wJTJzh%3DTaeZv2yqLG1-SZhfTjsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to