Which default Linux distribution does Travis CI apply when the `dist` key is omitted in `.travis.yml`?
0 reputation · 13 Feb 2025, 19:29 UTC
0 reputation · 13 Feb 2025, 19:29 UTC
The goal is to guarantee repeatable builds by understanding which base image Travis CI selects when a `.travis.yml` file does not explicitly declare a `dist` value.
Travis CI’s default distribution is not fixed; it has shifted from Trusty to Xenial to Focal and may vary depending on the age of the account or internal updates, making builds non‑repeatable if the field is left unspecified.
What is the current default distribution for newly created accounts? How can a user determine the default `dist` that Travis CI will use for their repository? Does explicitly setting `dist` eliminate variability across time and account age?
35275 reputation · 14 Feb 2025, 06:15 UTC
There is no single fixed default. When dist is omitted from .travis.yml, Travis CI selects a base image based on the era in which the account was created. Historical transitions moved the default from Ubuntu Trusty (14.04) to Xenial (16.04), then Bionic (18.04), and more recently to Focal (20.04) for new accounts. Because the default is treated as an infrastructure implementation detail rather than a stable API, the exact image can differ between accounts and may change without notice.
Confirmed: Travis CI has changed its default Linux distribution multiple times. The documented transitions are Trusty until mid-2018, Xenial from mid-2018 to early 2020, Bionic between 2020 and 2022, and Focal announced as the default for new accounts around 2023.
Likely explanation: A repository inherits the default that was current when its parent account was created. An account opened before a transition may continue to receive the older image, while a newly created account receives the newest default. This inheritance behavior explains why two repositories can run on different Ubuntu versions even with identical configuration files.
You can verify the actual base image without guessing:
.travis.yml script section:
script:
- cat /etc/os-release
VERSION_ID or DISTRIB_DESCRIPTION line.dist field. A null value means the build falls back to the account-inherited default.dist eliminate variability?Yes. Adding an explicit dist value—such as dist: focal—pins the base image for that repository. It removes dependence on account age and protects against future infrastructure changes. For repeatable builds, treat an explicit dist as mandatory rather than optional.
Note: Because Travis CI does not publish the default as a stable contract, the Focal default for new accounts should be treated as provisional and verified against a live build log.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 13 Feb 2025, 23:51 UTC
To determine which distribution is currently being applied to a repository without a dist key, the most reliable method is to inspect the build logs. Travis CI typically prints the environment details during the initialization phase of the job.
If the logs are unclear, you can force the environment to reveal its version by adding a temporary script step to your .travis.yml:
script:
- cat /etc/os-release
This command outputs the specific Ubuntu version and codename (e.g., VERSION_CODENAME=focal) currently in use. While newer accounts generally default to Ubuntu Focal (20.04), legacy accounts may still be pinned to Xenial (16.04) or Bionic (18.04) based on the repository's creation date. Explicitly defining the dist key is the only way to prevent the environment from shifting during platform-wide updates.