-
Notifications
You must be signed in to change notification settings - Fork 1.5k
SMP experiment selection and codeowners v2 #54833
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
268b764
dc5921c
d597ec5
fc7362e
220dc69
a19c2c0
04952f9
cd9952e
3cbab7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: "SMP label sync check" | ||
|
|
||
| # Keeps the SMP selection manifest (test/regression/selection.yaml) and the repo's `smp/*` labels | ||
| # in sync: the manifest's `labels:` keys are the registry, so every manifest label must exist as a | ||
| # repo label (so it can be applied), and every repo `smp/*` label must be declared in the manifest | ||
| # (no orphans). Runs when the manifest changes. (Out-of-band repo-label drift when the manifest is | ||
| # untouched would need a scheduled run — a follow-up.) | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - test/regression/selection.yaml | ||
| branches: | ||
| - main | ||
| - "[0-9]+.[0-9]+.x" | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| smp-label-sync: | ||
| if: github.event.pull_request.head.repo.full_name == github.repository # non-fork PRs only | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout selection manifest | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| sparse-checkout: test/regression/selection.yaml | ||
| persist-credentials: false | ||
| - name: Manifest labels must match repo smp/* labels | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GITHUB_REPOSITORY: ${{ github.repository }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Labels declared in the manifest (the registry). yq is preinstalled on ubuntu-latest. | ||
| yq -r '.labels // {} | keys | .[]' test/regression/selection.yaml | sort > manifest_labels.txt | ||
| # Existing smp/* labels in the repo. | ||
| gh label list --repo "$GITHUB_REPOSITORY" --limit 500 --json name -q '.[].name' \ | ||
| | grep '^smp/' | sort > repo_labels.txt || true | ||
| echo "== manifest labels =="; cat manifest_labels.txt | ||
| echo "== repo smp/* labels =="; cat repo_labels.txt | ||
| orphans=$(comm -13 manifest_labels.txt repo_labels.txt || true) # in repo, not in manifest | ||
| missing=$(comm -23 manifest_labels.txt repo_labels.txt || true) # in manifest, not in repo | ||
| rc=0 | ||
| if [ -n "$orphans" ]; then | ||
| echo "::error::Repo smp/* labels not declared in the manifest (delete them or add to selection.yaml):"; echo "$orphans"; rc=1 | ||
| fi | ||
| if [ -n "$missing" ]; then | ||
| echo "::error::Manifest labels not created in the repo (create them with 'gh label create'):"; echo "$missing"; rc=1 | ||
| fi | ||
| [ "$rc" -eq 0 ] && echo "Manifest labels and repo smp/* labels are in sync." | ||
| exit "$rc" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,36 @@ | ||
| # Config gate for the SMP experiment tree. Runs early (lint stage) so authors get fast feedback, | ||
| # and is BLOCKING: correctness problems (duplicate experiment names, malformed labels, | ||
| # Leaf-XOR-Dir violations, invalid runner) always fail; missing required metadata fails under | ||
| # --in-ci. Offline apart from downloading the smp binary. ebpf is excluded until it is modeled. | ||
| single-machine-performance-experiments-validate: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new GitLab job name is not covered by Useful? React with 👍 / 👎. |
||
| stage: lint | ||
| image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64 | ||
| tags: ["arch:amd64", "specific:true"] | ||
| needs: [] | ||
| rules: | ||
| - !reference [.except_coverage_pipeline] | ||
| - changes: | ||
| paths: | ||
| - test/regression/**/* | ||
| compare_to: $COMPARE_TO_BRANCH | ||
| variables: | ||
| SMP_VERSION: dev-pr4702-9b56514f7 | ||
| CONFIG_DIR: test/regression | ||
| AWS_NAMED_PROFILE: single-machine-performance | ||
| BOT_LOGIN: bot_login | ||
| BOT_TOKEN: bot_token | ||
| script: | ||
| # Fetch the SMP bot AWS creds and download the smp binary (same source as the run job). | ||
| - SMP_BOT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_LOGIN) | ||
| - SMP_BOT_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_TOKEN) | ||
| - aws configure set aws_access_key_id "$SMP_BOT_ID" --profile ${AWS_NAMED_PROFILE} | ||
| - aws configure set aws_secret_access_key "$SMP_BOT_KEY" --profile ${AWS_NAMED_PROFILE} | ||
| - aws configure set region us-west-2 --profile ${AWS_NAMED_PROFILE} | ||
| - aws --profile ${AWS_NAMED_PROFILE} s3 cp s3://smp-cli-releases/${SMP_VERSION}/x86_64-unknown-linux-musl/smp smp | ||
| - chmod +x smp | ||
| # Correctness always fails; missing metadata fails under --in-ci. | ||
| - ./smp experiments validate --target-config-dir ${CONFIG_DIR} --manifest ${CONFIG_DIR}/selection.yaml --exclude-path ebpf --in-ci | ||
|
|
||
| single_machine_performance-regression_detector-merge_base_check: | ||
| stage: functional_test | ||
| timeout: 10m | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the workflow-level
permissions: {}this job token only getscontents: read, but the step below callsgh label list; GitHub documents the repository-labels endpoint as requiringissues: readorpull-requests: readfor GitHub App/fine-grained tokens (https://docs.github.com/rest/issues/labels#list-labels-for-a-repository). On any same-repo PR that changesselection.yaml, the label list call will 403 before the manifest can be checked, so grant one of those read scopes.Useful? React with 👍 / 👎.