Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): regression detection overhaul #21567

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pront
Copy link
Contributor

@pront pront commented Oct 21, 2024

Summary

This PR introduces a new regression detection workflow, quite similar to the existing one. However, there are a few notable changes here, this workflow:

  • Runs on a nightly schedule.
  • Supports inputs, a base SHA and a comparison SHA (this will help when bisecting commits).
  • Completely removes all logic related to PRs. The expectation is to examine the nightly results in the ops channel or run ad-hoc workflows.
image

Test plan

  • I tested the input resolution and validation on a fork.
  • However, this needs more E2E testing.
  • To avoid disruptions, I am creating this under a different name with the intention to replace the existing workflow.

@pront pront force-pushed the pront/regression-workflow-v2 branch 2 times, most recently from c9be068 to 1419824 Compare October 21, 2024 14:42
Comment on lines 1 to 109
# - The comparison SHA:
# - If not specified, the current HEAD of origin/master is used.
#
# This workflow runs regression detection experiments, performing relative
# evaluations of the baseline SHA and comparison SHA. The exact SHAs are determined
# by how the workflow is triggered.
#
# The goal is to provide quick feedback on Vector's performance across a variety
# of configurations, checking if throughput performance has degraded or become
# more variable in the comparison SHA relative to the baseline SHA.
#
# Docker image tags are based on the resolved SHAs.

name: Regression Detection Suite (new)

on:
workflow_dispatch:
inputs:
baseline-sha:
description: "The SHA to use as the baseline (optional). If not provided, it defaults to the SHA from 24 hours ago."
required: false
comparison-sha:
description: "The SHA to use for comparison (optional). If not provided, it defaults to the current HEAD of the origin/master branch."
required: false
schedule:
- cron: '0 6 * * 1-5' # Runs at 6 AM UTC on weekdays (Monday to Friday)

env:
SINGLE_MACHINE_PERFORMANCE_API: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_API }}
SMP_WARMUP_SECONDS: 70 # default is 45 seconds

jobs:

resolve-inputs:
runs-on: ubuntu-latest
outputs:
baseline-sha: ${{ steps.set_and_validate_shas.outputs.BASELINE_SHA }}
comparison-sha: ${{ steps.set_and_validate_shas.outputs.COMPARISON_SHA }}
baseline-tag: ${{ steps.set_and_validate_shas.outputs.BASELINE_TAG }}
comparison-tag: ${{ steps.set_and_validate_shas.outputs.COMPARISON_TAG }}
smp-version: ${{ steps.experimental-meta.outputs.SMP_CRATE_VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # need to pull repository history to find merge bases

- name: Set and Validate SHAs
id: set_and_validate_shas
run: |
# Set baseline SHA
if [ -z "${{ github.event.inputs.baseline-sha }}" ]; then
BASELINE_SHA=$(git rev-list -n 1 --before="24 hours ago" origin/master)
echo "Using baseline SHA from 24 hours ago: ${BASELINE_SHA}"
else
BASELINE_SHA="${{ github.event.inputs.baseline-sha }}"
echo "Using provided baseline SHA: ${BASELINE_SHA}"
fi

# Validate baseline SHA
if [ -n "${BASELINE_SHA}" ] && git cat-file -e "${BASELINE_SHA}^{commit}"; then
echo "Baseline SHA is valid."
else
echo "Invalid baseline SHA: ${BASELINE_SHA}."
exit 1
fi

# Set comparison SHA
if [ -z "${{ github.event.inputs.comparison-sha }}" ]; then
COMPARISON_SHA=$(git rev-parse origin/master)
echo "Using current HEAD for comparison SHA: ${COMPARISON_SHA}"
else
COMPARISON_SHA="${{ github.event.inputs.comparison-sha }}"
echo "Using provided comparison SHA: ${COMPARISON_SHA}"
fi

# Validate comparison SHA
if [ -n "${COMPARISON_SHA}" ] && git cat-file -e "${COMPARISON_SHA}^{commit}"; then
echo "Comparison SHA is valid."
else
echo "Invalid comparison SHA: ${COMPARISON_SHA}."
exit 1
fi

# Set tags and export them
BASELINE_TAG="workflow_dispatch-${COMPARISON_SHA}-${BASELINE_SHA}"
COMPARISON_TAG="workflow_dispatch-${COMPARISON_SHA}-${COMPARISON_SHA}"

echo "BASELINE_SHA=${BASELINE_SHA}" >> $GITHUB_OUTPUT
echo "COMPARISON_SHA=${COMPARISON_SHA}" >> $GITHUB_OUTPUT

echo "BASELINE_TAG=${BASELINE_TAG}" >> $GITHUB_OUTPUT
echo "COMPARISON_TAG=${COMPARISON_TAG}" >> $GITHUB_OUTPUT

- name: Set SMP version
id: experimental-meta
run: |
export SMP_CRATE_VERSION="0.16.1"
echo "smp crate version: ${SMP_CRATE_VERSION}"
echo "SMP_CRATE_VERSION=${SMP_CRATE_VERSION}" >> $GITHUB_OUTPUT
Copy link
Contributor Author

@pront pront Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for the reviewers:

  • Lines [1,109] are the main changes.
  • The job compute-metadata was merged into this one.
  • Anything related to pull_request and pull_request_review events was deleted.

- analyze-experiment
env:
FAILED: ${{ contains(needs.*.result, 'failure') }}
steps:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of steps were deleted here since we no longer have a PR to update.

@pront pront force-pushed the pront/regression-workflow-v2 branch from 1419824 to 84661ff Compare October 21, 2024 15:02
echo "SOURCE_CHANGED='${SOURCE_CHANGED}'"
echo "SOURCE_CHANGED=${SOURCE_CHANGED}" >> $GITHUB_OUTPUT

should-run-gate:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK there is no way to stop the whole workflow and mark it as skipped. So this job is used a dependency for all following jobs.


jobs:

resolve-inputs:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pront pront force-pushed the pront/regression-workflow-v2 branch from 84661ff to c00bad5 Compare October 21, 2024 15:50
@pront pront requested a review from jszwedko October 21, 2024 15:54
@pront pront marked this pull request as ready for review October 21, 2024 15:54
@pront pront requested a review from a team as a code owner October 21, 2024 15:54
@pront pront added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Oct 21, 2024
@datadog-vectordotdev
Copy link

Datadog Report

Branch report: pront/regression-workflow-v2
Commit report: 4a9dff3
Test service: vector

✅ 0 Failed, 7 Passed, 0 Skipped, 25.44s Total Time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Changes in this PR do not need user-facing explanations in the release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant