mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-29 06:04:06 +00:00
feat(ci): publish precompiled query regression helpers with pin update PRs
Signed-off-by: WenyXu <wenymedia@gmail.com>
This commit is contained in:
@@ -100,6 +100,7 @@ jobs:
|
||||
python3 tests/perf/test_query_regression_runner_otlp_trace_load.py
|
||||
python3 tests/perf/test_query_regression_summary_otlp.py
|
||||
python3 tests/perf/test_query_regression_case_selection.py
|
||||
python3 tests/perf/test_query_regression_helpers.py
|
||||
python3 tests/perf/test_query_regression_nightly_refs.py
|
||||
python3 tests/perf/test_query_regression_slash.py
|
||||
python3 tests/perf/test_aliyun_ecs_runner_scripts.py
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
name: Publish query regression helpers
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- src/cmd/src/bin/query_perf_fixture.rs
|
||||
- src/cmd/src/bin/query_perf_fixture/**
|
||||
- src/cmd/src/bin/query_regression_runner.rs
|
||||
- src/cmd/src/bin/query_regression_runner/**
|
||||
- docker/query-regression-helpers/**
|
||||
- .github/workflows/publish-query-regression-helpers.yml
|
||||
- .github/scripts/publish-query-regression-helpers.sh
|
||||
- Cargo.lock
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Serialize publication so pin-update PRs follow source order.
|
||||
concurrency:
|
||||
group: publish-query-regression-helpers
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
provision:
|
||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
outputs:
|
||||
label: ${{ steps.provision.outputs.label }}
|
||||
instance_id: ${{ steps.provision.outputs.instance_id }}
|
||||
runner_name: ${{ steps.provision.outputs.runner_name }}
|
||||
steps:
|
||||
- name: Checkout trusted provisioning scripts
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ github.sha }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Provision ECS runner
|
||||
id: provision
|
||||
uses: ./.github/actions/aliyun-ecs-create
|
||||
with:
|
||||
access-key-id: ${{ secrets.ALICLOUD_ECS_ACCESS_KEY_ID }}
|
||||
access-key-secret: ${{ secrets.ALICLOUD_ECS_ACCESS_KEY_SECRET }}
|
||||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
region-id: ${{ vars.ALIYUN_ECS_REGION_ID }}
|
||||
vswitch-id: ${{ vars.ALIYUN_ECS_VSWITCH_ID }}
|
||||
security-group-id: ${{ vars.ALIYUN_ECS_SECURITY_GROUP_ID }}
|
||||
instance-type: ${{ vars.ALIYUN_ECS_INSTANCE_TYPE }}
|
||||
# Preserve query regression's original resource and janitor budgets.
|
||||
system-disk-gib: '80'
|
||||
ttl-hours: '4'
|
||||
enable-docker: 'true'
|
||||
resource-group-id: ${{ vars.ALIYUN_ECS_RESOURCE_GROUP_ID }}
|
||||
image-id: ${{ vars.QUERY_REGRESSION_ECS_IMAGE_ID }}
|
||||
runner-uid: ${{ vars.QUERY_REGRESSION_RUNNER_UID || '1001' }}
|
||||
runner-gid: ${{ vars.QUERY_REGRESSION_RUNNER_GID || '1001' }}
|
||||
|
||||
publish:
|
||||
needs: provision
|
||||
runs-on: ${{ needs.provision.outputs.label }}
|
||||
timeout-minutes: 150
|
||||
outputs:
|
||||
image: ${{ steps.publish.outputs.image }}
|
||||
env:
|
||||
CARGO_HOME: /home/runner/.cargo
|
||||
CARGO_TARGET_DIR: /home/runner/query-regression-target
|
||||
RUSTUP_HOME: /opt/rustup
|
||||
RUSTUP_TOOLCHAIN: nightly-2026-03-21
|
||||
RUSTUP_AUTO_INSTALL: "0"
|
||||
CARGO_INCREMENTAL: "0"
|
||||
RUSTFLAGS: -D warnings -C link-arg=-fuse-ld=mold
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: greptime-registry.cn-hangzhou.cr.aliyuncs.com
|
||||
username: ${{ secrets.ALICLOUD_USERNAME }}
|
||||
password: ${{ secrets.ALICLOUD_PASSWORD }}
|
||||
- name: Build, verify and publish helpers
|
||||
id: publish
|
||||
run: bash .github/scripts/publish-query-regression-helpers.sh
|
||||
- name: Upload helper validation evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: helpers-validation
|
||||
path: helpers-validation/
|
||||
if-no-files-found: warn
|
||||
|
||||
update-pin:
|
||||
needs: publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
- name: Open image pin update PR
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
HELPERS_IMAGE: ${{ needs.publish.outputs.image }}
|
||||
run: bash .github/scripts/update-query-regression-helpers-image.sh
|
||||
|
||||
teardown:
|
||||
if: ${{ always() && needs.provision.outputs.instance_id != '' }}
|
||||
needs: [provision, publish]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout trusted teardown scripts
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ github.sha }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Teardown ECS runner
|
||||
uses: ./.github/actions/aliyun-ecs-delete
|
||||
with:
|
||||
access-key-id: ${{ secrets.ALICLOUD_ECS_ACCESS_KEY_ID }}
|
||||
access-key-secret: ${{ secrets.ALICLOUD_ECS_ACCESS_KEY_SECRET }}
|
||||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
region-id: ${{ vars.ALIYUN_ECS_REGION_ID }}
|
||||
instance-id: ${{ needs.provision.outputs.instance_id }}
|
||||
runner-name: ${{ needs.provision.outputs.runner_name }}
|
||||
@@ -36,6 +36,11 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
helpers_image:
|
||||
description: Helpers image@sha256 or pinned (empty builds helpers from source)
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
cargo_profile:
|
||||
description: Cargo profile to build base and candidate binaries with
|
||||
required: false
|
||||
@@ -100,6 +105,11 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
helpers_image:
|
||||
description: Helpers image@sha256 or pinned (empty builds helpers from source)
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
cargo_profile:
|
||||
description: Cargo profile to build base and candidate binaries with
|
||||
required: true
|
||||
@@ -152,6 +162,7 @@ jobs:
|
||||
python3 tests/perf/test_query_regression_runner_otlp_trace_load.py
|
||||
python3 tests/perf/test_query_regression_summary_otlp.py
|
||||
python3 tests/perf/test_query_regression_case_selection.py
|
||||
python3 tests/perf/test_query_regression_helpers.py
|
||||
python3 tests/perf/test_query_regression_nightly_refs.py
|
||||
python3 tests/perf/test_query_regression_slash.py
|
||||
python3 tests/perf/test_aliyun_ecs_runner_scripts.py
|
||||
@@ -191,7 +202,7 @@ jobs:
|
||||
# Preserve query regression's original resource and janitor budgets.
|
||||
system-disk-gib: '80'
|
||||
ttl-hours: '4'
|
||||
enable-docker: ${{ inputs.base_image != '' || inputs.candidate_image != '' }}
|
||||
enable-docker: ${{ inputs.base_image != '' || inputs.candidate_image != '' || inputs.helpers_image != '' }}
|
||||
resource-group-id: ${{ vars.ALIYUN_ECS_RESOURCE_GROUP_ID }}
|
||||
image-id: ${{ vars.QUERY_REGRESSION_ECS_IMAGE_ID }}
|
||||
runner-uid: ${{ vars.QUERY_REGRESSION_RUNNER_UID || '1001' }}
|
||||
@@ -235,6 +246,7 @@ jobs:
|
||||
PR_NUMBER: ${{ inputs.pr_number }}
|
||||
HEAD_REPO: ${{ inputs.head_repo }}
|
||||
BASE_REPO: ${{ inputs.base_repo }}
|
||||
HELPERS_IMAGE: ${{ inputs.helpers_image }}
|
||||
BASE_IMAGE: ${{ inputs.base_image }}
|
||||
CANDIDATE_IMAGE: ${{ inputs.candidate_image }}
|
||||
BASE_REF: ${{ inputs.base_ref }}
|
||||
@@ -249,11 +261,11 @@ jobs:
|
||||
steps:
|
||||
- name: Validate image target admission
|
||||
run: |
|
||||
if [[ "${PR_ADMISSION}" == "true" && ( -n "${BASE_IMAGE}" || -n "${CANDIDATE_IMAGE}" ) ]]; then
|
||||
if [[ "${PR_ADMISSION}" == "true" && ( -n "${BASE_IMAGE}" || -n "${CANDIDATE_IMAGE}" || -n "${HELPERS_IMAGE}" ) ]]; then
|
||||
echo "PR admission requires source targets for verified commit attribution." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "${BASE_IMAGE}" || -n "${CANDIDATE_IMAGE}" ]]; then
|
||||
if [[ -n "${BASE_IMAGE}" || -n "${CANDIDATE_IMAGE}" || -n "${HELPERS_IMAGE}" ]]; then
|
||||
docker info >/dev/null
|
||||
fi
|
||||
|
||||
@@ -451,6 +463,7 @@ jobs:
|
||||
> "${GITHUB_WORKSPACE}/query-regression-trusted-scripts/query-regression-summary.py"
|
||||
|
||||
- name: Verify runner image tools
|
||||
if: ${{ inputs.base_image == '' || inputs.candidate_image == '' || inputs.helpers_image == '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -567,6 +580,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Prepare query regression cache
|
||||
if: ${{ inputs.base_image == '' || inputs.candidate_image == '' || inputs.helpers_image == '' }}
|
||||
shell: bash
|
||||
working-directory: src
|
||||
run: |
|
||||
@@ -762,7 +776,16 @@ jobs:
|
||||
git reset --hard "${VERIFIED_CANDIDATE_SHA}"
|
||||
git clean -ffdx
|
||||
|
||||
- name: Extract precompiled query regression helpers
|
||||
if: ${{ inputs.helpers_image != '' }}
|
||||
working-directory: src
|
||||
run: |
|
||||
python3 .github/scripts/query-regression-helpers.py "$HELPERS_IMAGE" \
|
||||
"$GITHUB_WORKSPACE/query-regression-bins/candidate"
|
||||
cat "$GITHUB_WORKSPACE/query-regression-bins/candidate/helpers-image.json" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Build candidate greptime and query regression helpers
|
||||
if: ${{ inputs.candidate_image == '' || inputs.helpers_image == '' }}
|
||||
working-directory: src
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -770,8 +793,10 @@ jobs:
|
||||
if [[ -z "${CANDIDATE_IMAGE}" ]]; then
|
||||
cargo build --profile "${CARGO_PROFILE}" -p cmd --bin greptime
|
||||
fi
|
||||
cargo build --profile "${CARGO_PROFILE}" -p cmd --bin query_perf_fixture --features dev-tools
|
||||
cargo build --profile "${CARGO_PROFILE}" -p cmd --bin query_regression_runner --features dev-tools
|
||||
if [[ -z "${HELPERS_IMAGE}" ]]; then
|
||||
cargo build --profile "${CARGO_PROFILE}" -p cmd --bin query_perf_fixture --features dev-tools
|
||||
cargo build --profile "${CARGO_PROFILE}" -p cmd --bin query_regression_runner --features dev-tools
|
||||
fi
|
||||
candidate_build_elapsed="${SECONDS}"
|
||||
printf 'Candidate greptime and query regression helper cargo builds elapsed: %s seconds\n' "${candidate_build_elapsed}"
|
||||
printf -- '- Candidate greptime and query regression helper cargo builds: %s seconds\n' "${candidate_build_elapsed}" >> "${GITHUB_STEP_SUMMARY}"
|
||||
@@ -785,10 +810,12 @@ jobs:
|
||||
cp "${CARGO_TARGET_DIR}/${target_dir}/greptime" \
|
||||
"${GITHUB_WORKSPACE}/query-regression-bins/candidate/greptime"
|
||||
fi
|
||||
cp "${CARGO_TARGET_DIR}/${target_dir}/query_perf_fixture" \
|
||||
"${GITHUB_WORKSPACE}/query-regression-bins/candidate/query_perf_fixture"
|
||||
cp "${CARGO_TARGET_DIR}/${target_dir}/query_regression_runner" \
|
||||
"${GITHUB_WORKSPACE}/query-regression-bins/candidate/query_regression_runner"
|
||||
if [[ -z "${HELPERS_IMAGE}" ]]; then
|
||||
cp "${CARGO_TARGET_DIR}/${target_dir}/query_perf_fixture" \
|
||||
"${GITHUB_WORKSPACE}/query-regression-bins/candidate/query_perf_fixture"
|
||||
cp "${CARGO_TARGET_DIR}/${target_dir}/query_regression_runner" \
|
||||
"${GITHUB_WORKSPACE}/query-regression-bins/candidate/query_regression_runner"
|
||||
fi
|
||||
|
||||
- name: Run query regression
|
||||
id: run
|
||||
@@ -830,6 +857,7 @@ jobs:
|
||||
query-regression-work/**/logs/**
|
||||
query-regression-work/**/otelgen/**
|
||||
query-regression-summary.md
|
||||
query-regression-bins/candidate/helpers-image.json
|
||||
machine-telemetry.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
@@ -35,6 +35,11 @@ on:
|
||||
description: Rebuild the query-regression ECS runner image (and update QUERY_REGRESSION_ECS_IMAGE_ID + RUNNER_IMAGE_EPOCH)
|
||||
required: false
|
||||
default: false
|
||||
release_query_regression_helpers_image:
|
||||
type: boolean
|
||||
description: Publish precompiled query regression helpers and open a pin-update PR
|
||||
required: false
|
||||
default: false
|
||||
update_dev_builder_image_tag:
|
||||
type: boolean
|
||||
description: Update the DEV_BUILDER_IMAGE_TAG in Makefile and create a PR
|
||||
@@ -451,3 +456,8 @@ jobs:
|
||||
echo "## Lockstep updates" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- QUERY_REGRESSION_ECS_IMAGE_ID → \`${image_id}\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- RUNNER_IMAGE_EPOCH → \`${new_epoch}\` (PR on \`${BRANCH}\`, pending review/merge)" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
release-query-regression-helpers:
|
||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && inputs.release_query_regression_helpers_image }}
|
||||
uses: ./.github/workflows/publish-query-regression-helpers.yml
|
||||
secrets: inherit
|
||||
|
||||
Reference in New Issue
Block a user