View on GitHub

tsb

A Transitive Source Builder for managing builds across multiple repositories

tsb

tsb is the Transitive Source Builder.

It is designed to allow organizations, teams, and individuals to manage their builds of systems that may be shared with others.

There is a quickstart guide to getting going with tsb as well as a strategy guide for managing downstream repositories in general.

Usage: tsb [options] [commands]

Commands

Config Repository

tsb operates on a repository, not just a config file. The repository should have three .yml files at the root:

/docker-compose.yml
/patches.yml
/repos.yml

During builds, the source for each repository will be checked out to:

/src/{reponame}

where {reponame} is the name of that repository in the repos file. The docker-compose.yml file will need to refer to these repositories or their contents by this path.

Builds will be expected to produce a list of artefacts in:

/dist/

The repository will require additional files to support those files

docker-compose.yml

The compose file may define any number of targets with any names, they will all be run as part of the build process. One or more dockerfiles may be referenced from here.

Source repositories will be in predictable locations as noted above (/src/{reponame}), so they can and should be mounted as volumes in the container. Build tasks should generally not modify the volumes directly, but rather copy them to a working directory if they might be modified by build tools.

Likewise, /dist/ should generally be mounted so that output files can be put there.

Dockerfile

The dockerfile (referenced by the docker-compose.yml) should define the build environment. Generally, it should add a script that serves as the entrypoint for the build. It should not run the build directly via RUN instructions, since build states may be cached by docker.

The run script should copy artefacts and log files to the location in the container where /dist/ is mounted and return 0 iff the build was successful.

patches.yml

patches.yml is a YAML 1.2 file. It should be a list of whose members are hashes or branch subscriptions:

superwidget:
  changesets:
  - {changeset1}
  - branch: beta
    changesets:
      - {changesetA}
      - {changesetB}
  - {changeset2}

The hashes can refer to any changeset in any of the referenced sources. Each changeset will be cherry-picked, in order, to the head of the branch to be built.

The patches.yml file can be empty. Indeed, empty is the most desirable state, since that means building directly against the primary repository.

This file will not usually need to be modified manually. The tsb cherry, tsb subscribe and tsb update commands will safely modify this file.

repos.yml

repos.yml is a YAML 1.2 file. It should be an object with a member for each repository:

superwidget:
  src: https://upstream.example.net/repos/superwidget
  branch: master
  head: 4817590950ca0b52d3336011a1abdbb6f906e23228c5857cc0f7703828f6966f
  extra:
    - https://private.example.com/repos/superwidget-alpha
    - path: https://private.example.com/repos/superwidget-beta
      name: beta
hyperwidget:
  src: https://upstream.example.net/repos/hyperwidget
  branch: lts-7.2

Each repository member object should have:

When building, branch is ignored; head controls. branch is used to update head with tsb update.