Skip to content

Compare with most recent build #35

@simonbyrne

Description

@simonbyrne

For some CI infra, it would be helpful if we could compare with the most recent (or perhaps n most recent?) builds on the main branch. This could be helpful for regression testing (i.e. have our results changed?), and performance (how has our scaling changed).

Buildkite provides two mechanisms for storing data:

Initially we will use artifacts, as they are more useful for storing data. The main problem is then "what is the step id of the previous job"? The best way to do this is probably something like:

  1. Find the most recent commit that is also a commit on the main branch. Once the repository is checked out, we can do:
    git merge-base HEAD main
    
  2. Query the buildkite API for this comnit:
    curl -H "Authorization: Bearer $TOKEN" 'https://api.buildkite.com/v2/organizations/clima/pipelines/climaatmos-scaling/builds?commit=$COMMIT&per_page=1' | jq -r 'first.id'
    
  3. If this doesn't exist (e.g. in ClimaAtmos-scaling, we only run it nightly, not on every commit), just get the last one on the main branch
    curl -H "Authorization: Bearer $TOKEN" 'https://api.buildkite.com/v2/organizations/clima/pipelines/climaatmos-scaling/builds?branch=main&per_page=1' | jq -r 'first.id'
    
  4. store this in the build meta-data (similar to 729741a), so that we don't need to store it for subsequent jobs in this build (prev_build_id?)
  5. set an appropriate environment variable (PREV_BUILDKITE_BUILD_ID?)

In that way, the comparison code can then download the artifact by

buildkite-agent artifact download --build $PREV_BUILDKITE_BUILD_ID --step $BUILDKITE_STEP_KEY artifact_name destination

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions