I just stumbled upon this when editing .travis.yml, and I'm
trying to understand how the $CACHE_NAME trick is supposed to
work.

If I understood the Travis documentation correctly, all
environment variables will affect the cache id (including
$CONFIG, in the case below).  This would mean the two entries
would still use a different cache even if $CACHE_NAME is the
same.

See, for example:
https://travis-ci.org/github/qemu/qemu/jobs/735738551#L965
https://travis-ci.org/github/qemu/qemu/jobs/735738553#L967

Both build tasks have the same value for $CACHE_NAME, but they
are fetching two different cache URLs:

master/cache--linux-focal-50ba7438064455bdb04bb41dcde2c91c34bb797265fe435b84cee4bae7d9b61d--compiler-gcc.tgz
master/cache--linux-focal-8991cfc9b7f3f268e7e50aff4218daa4c206597ae796c60643a84ed58bba0cfb--compiler-gcc.tgz


On Tue, Sep 03, 2019 at 03:26:47PM +0200, Philippe Mathieu-Daudé wrote:
> These jobs build different components but use the same
> host features. Put them in the same cache bucket.
> 
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  .travis.yml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/.travis.yml b/.travis.yml
> index c64a551829..e362c3fe02 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -120,11 +120,13 @@ matrix:
>  
>      - env:
>          - CONFIG="--enable-debug --enable-debug-tcg --disable-user"
> +        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug"
>  
>  
>      # TCG debug can be run just on it's own and is mostly agnostic to 
> user/softmmu distinctions
>      - env:
>          - CONFIG="--enable-debug-tcg --disable-system"
> +        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug"
>  
>  
>      - env:
> -- 
> 2.20.1
> 
> 

-- 
Eduardo


Reply via email to