Skip to content

Commit

Permalink
Merge pull request #26497 from nrainer-materialize/buildkite-insights…
Browse files Browse the repository at this point in the history
…/nightly-shortcut

buildkite insights: make pipeline a positional arg
  • Loading branch information
nrainer-materialize authored Apr 9, 2024
2 parents 01f513f + b5a8f93 commit 204ec56
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,42 @@ This tool allows searching Buildkite annotations in recent builds.

## Usage
```
usage: buildkite-annotation-search [-h] --pipeline
{cleanup,coverage,deploy,deploy-lsp,deploy-mz,deploy-website,license,nightlies,release-qualification,security,sql-logic-tests,tests,www}
[--branch BRANCH] [--fetch-builds {auto,always,never}] [--fetch-annotations {auto,always,never}]
[--max-build-fetches MAX_BUILD_FETCHES] [--first-build-page-to-fetch FIRST_BUILD_PAGE_TO_FETCH]
[--max-results MAX_RESULTS] [--only-one-result-per-build] [--only-failed-builds]
[--only-failed-build-step-key ONLY_FAILED_BUILD_STEP_KEY] [--use-regex]
[pattern ...]
usage: buildkite-annotation-search [-h]
[--branch BRANCH]
[--fetch-builds {auto,always,never}]
[--fetch-annotations {auto,always,never}]
[--max-build-fetches MAX_BUILD_FETCHES]
[--first-build-page-to-fetch FIRST_BUILD_PAGE_TO_FETCH]
[--max-results MAX_RESULTS]
[--only-one-result-per-build]
[--only-failed-builds]
[--only-failed-build-step-key ONLY_FAILED_BUILD_STEP_KEY]
[--use-regex]
{cleanup,coverage,deploy,deploy-lsp,deploy-mz,deploy-website,license,nightlies,release-qualification,security,sql-logic-tests,tests,www} pattern
```

## Examples

Builds that have an annotation containing `Error { kind: Db, cause: Some(DbError`

```
bin/buildkite-annotation-search --pipeline tests "Error { kind: Db, cause: Some(DbError"
bin/buildkite-annotation-search tests "Error { kind: Db, cause: Some(DbError"
```

Builds that have an annotation containing `Error` and include a larger number of recent builds

```
bin/buildkite-annotation-search --pipeline tests --max-build-fetches 10 "Error"
bin/buildkite-annotation-search tests --max-build-fetches 10 "Error"
```

Builds on branch `main` that have an annotation matching the regex pattern `cannot serve requested as_of AntiChain.*testdrive-materialized-1`

```
bin/buildkite-annotation-search --pipeline tests --branch main --use-regex "cannot serve requested as_of AntiChain.*testdrive-materialized-1"
bin/buildkite-annotation-search tests --branch main --use-regex "cannot serve requested as_of AntiChain.*testdrive-materialized-1"
```

Nightly builds that failed and have an annotation containing `fivetran-destination action=describe`

```
bin/buildkite-annotation-search --pipeline nightlies --only-failed-builds "fivetran-destination action=describe"
bin/buildkite-annotation-search nightlies --only-failed-builds "fivetran-destination action=describe"
```
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ def main(
formatter_class=argparse.RawDescriptionHelpFormatter,
)

parser.add_argument("pattern", nargs="*", type=str)

parser.add_argument(
"--pipeline",
"pipeline",
choices=MZ_PIPELINES,
type=str,
required=True,
help="Use * for all pipelines",
)

parser.add_argument("pattern", type=str)

parser.add_argument(
"--branch",
type=str,
Expand Down Expand Up @@ -262,9 +262,6 @@ def main(
)
args = parser.parse_args()

assert len(args.pattern) == 1, "Exactly one search pattern must be provided"
pattern = args.pattern[0]

main(
args.pipeline,
args.branch,
Expand All @@ -276,6 +273,6 @@ def main(
args.only_one_result_per_build,
args.only_failed_builds,
args.only_failed_build_step_key,
pattern,
args.pattern,
args.use_regex,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ This tool allows searching recent Buildkite builds to
## Usage
```
usage: buildkite-step-durations [-h]
[--pipeline {cleanup,coverage,deploy,deploy-lsp,deploy-mz,deploy-website,license,nightlies,release-qualification,security,sql-logic-tests,tests,www}]
[--build-step-key BUILD_STEP_KEY]
[--fetch {auto,always,never}]
[--max-fetches MAX_FETCHES]
[--branch BRANCH]
[--build-state {running,scheduled,passed,failing,failed,blocked,canceled,canceling,skipped,not_run,finished}]
[--build-step-state {assigned,broken,canceled,failed,passed,running,scheduled,skipped,timed_out,unblocked,waiting,waiting_failed}]
[--output-type {txt,txt-short,csv}]
{cleanup,coverage,deploy,deploy-lsp,deploy-mz,deploy-website,license,nightlies,release-qualification,security,sql-logic-tests,tests,www}
```

## Examples

Recent executions of build step "AWS (Localstack)" in Nightly on all branches

```
bin/buildkite-step-insights --pipeline nightlies --build-step-key "aws-localstack" --branch "*"
bin/buildkite-step-insights nightlies --build-step-key "aws-localstack" --branch "*"
```

Recent failures of build step "AWS (Localstack)" in Nightly on `main` branch

```
bin/buildkite-step-insights --pipeline nightlies --build-step-key "aws-localstack" --branch main --build-step-state "failed"
bin/buildkite-step-insights nightlies --build-step-key "aws-localstack" --branch main --build-step-state "failed"
```

Many recent executions of build step "Cargo test" on `main` branch in builds that failed due to any step

```
bin/buildkite-step-insights --build-step-key "cargo-test" --branch "main" --max-fetches 6 --build-state failed
bin/buildkite-step-insights tests --build-step-key "cargo-test" --branch "main" --max-fetches 6 --build-state failed
```

Most recent executions of "Cargo test" on `main` branch

```
bin/buildkite-step-insights --build-step-key "cargo-test" --branch "main" --fetch always
bin/buildkite-step-insights tests --build-step-key "cargo-test" --branch "main" --fetch always
```
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def main(
formatter_class=argparse.RawDescriptionHelpFormatter,
)

parser.add_argument("--pipeline", choices=MZ_PIPELINES, default="tests", type=str)
parser.add_argument("pipeline", choices=MZ_PIPELINES, type=str)
parser.add_argument("--build-step-key", action="append", default=[], type=str)
parser.add_argument(
"--fetch",
Expand Down

0 comments on commit 204ec56

Please sign in to comment.