Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
agents:
queue: hosted

steps:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: The PR description mentions a block step for fork-triggered builds, but I don’t see that gate before the runnable steps in this checked-in pipeline (and the test step mints the OIDC token). Is the block configured outside the repo, or should it be represented here so fork PRs can’t reach the token step before approval?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's in the static build step that uploads this YAML

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here's the server-side steps:

steps:
  # block the build for approval if triggered by a fork
  - block: "Allow this build to run?"
    prompt: ":rotating_light: Review the PR for concerning changes before unblocking"
    if: build.pull_request.repository.fork
    blocked_state: running
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload"
    agents:
      queue: hosted

- label: ":pytest: pytest {{matrix}}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate fork PRs before running test jobs

When this Buildkite pipeline is configured to build third-party fork PRs, it starts directly with command steps and never adds the block gate described for fork-triggered builds; Buildkite's block-step docs state that a block step pauses execution until a team member unblocks it (https://buildkite.com/docs/pipelines/configure/step-types/block-step). As written, forked PR code reaches .buildkite/steps/test, which mints and exports a Test Engine OIDC token before running tests, so untrusted fork builds can upload or poison results for the suite.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The block step is in the pipeline's server-side YAML steps, managed by infra-as-code, where it's safer from change.

command: ".buildkite/steps/test"
env:
PYTHON_VERSION: "{{matrix}}"
matrix:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

- label: ":pytest: pytest 3.13 / pytest>=9"
command: ".buildkite/steps/test"
env:
PYTHON_VERSION: "3.13"
UV_RUN_FLAGS: "--with pytest>=9"

- label: ":python: pylint {{matrix}}"
command: ".buildkite/steps/lint"
env:
PYTHON_VERSION: "{{matrix}}"
matrix:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
21 changes: 21 additions & 0 deletions .buildkite/steps/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")"/../ && pwd)"

cd "$__root"

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
source "$HOME/.local/bin/env"

# Install dependencies
uv python install "$PYTHON_VERSION"
uv sync --all-extras

# Run pylint
uv run pylint src/
30 changes: 30 additions & 0 deletions .buildkite/steps/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")"/../ && pwd)"

cd "$__root"

# Dogfood the collector: upload this repo's own test results to Test Engine.
# Uses an ephemeral OIDC token instead of a long-lived suite token, so this
# pipeline carries no secrets.
# https://buildkite.com/docs/pipelines/configure/tests/test-collection/oidc
SUITE_URL="https://buildkite.com/organizations/buildkite/analytics/suites/test-collector-python"
BUILDKITE_ANALYTICS_TOKEN="$(buildkite-agent oidc request-token --audience "$SUITE_URL" --lifetime 900)"
export BUILDKITE_ANALYTICS_TOKEN

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
source "$HOME/.local/bin/env"

# Install dependencies
uv python install "$PYTHON_VERSION"
uv sync --all-extras

# Run tests (UV_RUN_FLAGS is intentionally word-split, e.g. "--with pytest>=9")
# shellcheck disable=SC2086
uv run ${UV_RUN_FLAGS:-} pytest
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
55 changes: 0 additions & 55 deletions .github/workflows/python.yaml

This file was deleted.