boostorg / boost

Super-project for modularized Boost
https://github.com/boostorg/wiki/wiki/Getting-Started%3A-Overview
Boost Software License 1.0
6.97k stars 1.72k forks source link

CircleCI: autocancel workflows #888

Closed sdarwin closed 3 months ago

sdarwin commented 4 months ago

Note: create an API token before proceeding.

To prevent a problem with multiple commits occurring at nearly the same time and overwriting snapshots, there are two solutions:

  1. Force sequential builds. However, a difficulty is that each build takes 45 minutes, so when 10 commits happen in sequence the final snapshot won't be ready for 7 hours.

or

  1. Cancel previous in-progress builds. Only the newest commit is relevant when building a snapshot. This generally seems preferable since it's faster. A small disadvantage is that if one commit out of ten caused an error, it won't be immediately obvious which commit caused the error. Not often an issue.

This PR cancels in-progress builds. As an enhancement, it checks the time, and only cancels other jobs from within the last 10 minutes. Any job that's been running longer will be unlikely to conflict.

Token

  1. Create a Personal API Token https://app.circleci.com/settings/user/tokens (any token name)
  2. In the Project, add an Environment Variable https://app.circleci.com/settings/project/github/boostorg/boost/environment-variables Name: PERS_API_TOKEN_BOOST_5 (this name must match the script autocancel.sh) Value: the token from step 1
glenfe commented 3 months ago

@mclow could you please handle the token part of this?