APT update doesn't work unless you also add some package(s)

A configuration like this one:

addons:
    apt:
        sources:
            -   sourceline: ppa:ondrej/php
        update: true

doesn’t work as expected. It only adds the ppa, but won’t actually execute the apt update command afterward as expected.

Do you have a link to the build that shows the problem?

Yeah, sorry for not including it in the first place. Here: https://travis-ci.org/simPod/PHP-SNMP/jobs/547822486

You’re right. We invoke the update only when there is a package to install: https://github.com/travis-ci/travis-build/blob/960c5265c3942a9cc9276a11ad52bc2cc750021f/lib/travis/build/addons/apt.rb#L204-L224

I don’t see update: true used anywhere.

I only found out about it thanks to IDE support (imports http://json.schemastore.org/travis ) …

Anyway, it should trigger the update regardless of the package presence…why else would I add a new source if I didn’t want to use it? :slight_smile:

1 Like

Testing locally shows that apt-add-repository automatically calls apt update afterwards in Bionic. Judging by the build log, not so in Xenial.