Skip to content
Merged
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
default_install_hook_types:
- pre-commit
- pre-push
default_stages:
- pre-commit
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-merge-conflict

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.38.0
hooks:
- id: yamllint

- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint-system

- repo: https://github.com/crate-ci/typos
rev: v1.47.2
hooks:
- id: typos
32 changes: 32 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# For more information on how to configure typos, see:
# - https://github.com/crate-ci/typos/blob/master/docs/reference.md
# - https://github.com/crate-ci/typos/blob/master/README.md#false-positives

[files]
# By default, typos will not check files that are ignored by git.
# You can override this behavior here.
# For example, to check all files, you would set:
# ignore-vcs = false
extend-exclude = [
"**/.mise.toml",
]

[default]
# This section contains the default configuration for all file types.
# You can override these settings for specific file types below.

# A list of words that should be considered correct.
# This is useful for words that are specific to your project.
# For example:
# extend-words = {
# "myawesomeword" = "myawesomeword",
# "another" = "another",
# }

# A list of regular expressions that should be ignored.
# This is useful for things like URLs, or other patterns that
# are not words.
# For example, to ignore all URLs:
# extend-ignore-re = [
# "https?://[^`\\s]+",
# ]
30 changes: 30 additions & 0 deletions docs/azdo_help_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,36 @@ Aliases
view, status
```

### `azdo pipelines runs`

Manage pipeline runs

#### `azdo pipelines runs list [ORGANIZATION/]PROJECT [flags]`

List runs of pipelines in a project.

```
--branch strings Filter by source branch (repeatable; first value is honored by the SDK). Bare names get refs/heads/ prepended.
-q, --jq expression Filter JSON output using a jq expression
--json fields[=*] Output JSON with the specified fields. Prefix a field with '-' to exclude it.
--max-items int Maximum number of runs to return client-side (0 = unlimited).
--pipeline-id ints Limit to runs for these pipeline IDs (repeatable; first value is honored by the SDK).
--query-order string Order the results: finishTimeAscending, finishTimeDescending, queueTimeAscending, queueTimeDescending, startTimeAscending, startTimeDescending.
--reason strings Filter by reason (repeatable; first value is honored). Valid: manual, individualCI, batchedCI, schedule, scheduleForced, userCreated, pullRequest, etc.
--requested-for string Filter by the user who queued the run. Accepts @me to mean the authenticated user.
--result strings Filter by result (repeatable; first value is honored). Valid: none, succeeded, partiallySucceeded, failed, canceled.
--status strings Filter by status (repeatable; first value is honored). Valid: none, inProgress, completed, cancelling, postponed, notStarted, all.
--tag strings Filter by tags (all supplied tags must match).
-t, --template string Format JSON output using a Go template; see "azdo help formatting"
--top int Maximum number of runs to request per server page (0 = server default).
```

Aliases

```
l, ls
```

### `azdo pipelines variable-group`

Manage Azure DevOps variable groups
Expand Down
1 change: 1 addition & 0 deletions docs/azdo_pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Manage Azure DevOps pipelines
* [azdo pipelines agent](./azdo_pipelines_agent.md)
* [azdo pipelines list](./azdo_pipelines_list.md)
* [azdo pipelines pool](./azdo_pipelines_pool.md)
* [azdo pipelines runs](./azdo_pipelines_runs.md)
* [azdo pipelines variable-group](./azdo_pipelines_variable-group.md)

### ALIASES
Expand Down
11 changes: 11 additions & 0 deletions docs/azdo_pipelines_runs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Command `azdo pipelines runs`

Manage pipeline runs in an Azure DevOps project.

### Available commands

* [azdo pipelines runs list](./azdo_pipelines_runs_list.md)

### See also

* [azdo pipelines](./azdo_pipelines.md)
98 changes: 98 additions & 0 deletions docs/azdo_pipelines_runs_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
## Command `azdo pipelines runs list`

```
azdo pipelines runs list [ORGANIZATION/]PROJECT [flags]
```

List runs of pipelines in an Azure DevOps project. Mirrors
'az pipelines runs list'.

Filters support pipeline, branch, status, result, reason, requester,
and tags. The full result set is paginated server-side; use
--max-items to cap the response client-side.


### Options


* `--branch` `strings`

Filter by source branch (repeatable; first value is honored by the SDK). Bare names get refs/heads/ prepended.

* `-q`, `--jq` `expression`

Filter JSON output using a jq expression

* `--json` `fields`

Output JSON with the specified fields. Prefix a field with '-' to exclude it.

* `--max-items` `int` (default `0`)

Maximum number of runs to return client-side (0 = unlimited).

* `--pipeline-id` `ints`

Limit to runs for these pipeline IDs (repeatable; first value is honored by the SDK).

* `--query-order` `string`

Order the results: finishTimeAscending, finishTimeDescending, queueTimeAscending, queueTimeDescending, startTimeAscending, startTimeDescending.

* `--reason` `strings`

Filter by reason (repeatable; first value is honored). Valid: manual, individualCI, batchedCI, schedule, scheduleForced, userCreated, pullRequest, etc.

* `--requested-for` `string`

Filter by the user who queued the run. Accepts @me to mean the authenticated user.

* `--result` `strings`

Filter by result (repeatable; first value is honored). Valid: none, succeeded, partiallySucceeded, failed, canceled.

* `--status` `strings`

Filter by status (repeatable; first value is honored). Valid: none, inProgress, completed, cancelling, postponed, notStarted, all.

* `--tag` `strings`

Filter by tags (all supplied tags must match).

* `-t`, `--template` `string`

Format JSON output using a Go template; see "azdo help formatting"

* `--top` `int` (default `0`)

Maximum number of runs to request per server page (0 = server default).


### ALIASES

- `l`
- `ls`

### JSON Fields

`buildNumber`, `definition`, `finishTime`, `id`, `project`, `queueTime`, `reason`, `requestedBy`, `requestedFor`, `result`, `sourceBranch`, `sourceVersion`, `startTime`, `status`, `tags`, `uri`, `url`

### Examples

```bash
# List the 20 most recent runs for a project (default org)
azdo pipelines runs list Fabrikam --top 20

# Filter by pipeline and branch
azdo pipelines runs list MyOrg/Fabrikam --pipeline-id 42 --branch main

# Order by queue time, descending
azdo pipelines runs list Fabrikam --query-order queueTimeDescending

# Export as JSON
azdo pipelines runs list Fabrikam --json id,buildNumber,status,result
```

### See also

* [azdo pipelines runs](./azdo_pipelines_runs.md)
2 changes: 1 addition & 1 deletion internal/azdo/extensions/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (c *extensionClient) GetSubjectID(ctx context.Context, subject string) (uui
return uuid.Nil, err
}
if storageKey == nil {
return uuid.Nil, fmt.Errorf("failed to get storage key for user %s (%s)", subject, *((*subjects)[0].Descriptor))
return uuid.Nil, fmt.Errorf("failed to get storage key for user %s (%s)", subject, *(*subjects)[0].Descriptor)
}
return *storageKey.Value, nil
}
Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/auth/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ func loginRun(ctx util.CmdContext, opts *loginOptions) (err error) {
result, err := p.Select(
"What is your preferred protocol for Git operations?",
options[0],
options)
options,
)
if err != nil {
return err
}
Expand Down Expand Up @@ -154,7 +155,8 @@ func promptForOrganizationName(ctx util.CmdContext, _ *loginOptions) (organizati
orgType, err := p.Select(
"Azure DevOps Organization URL type?",
options[0],
options)
options,
)
if err != nil {
return organizationURL, organizationName, err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/auth/logout/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ func logoutRun(ctx util.CmdContext, opts *logoutOptions) (err error) {
organizationName = organizations[0]
} else {
selected, err := p.Select(
"What organization do you want to log out of?", "", organizations)
"What organization do you want to log out of?", "", organizations,
)
if err != nil {
return fmt.Errorf("could not prompt: %w", err)
}
Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/auth/setupgit/setupgit.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ func setupGitRun(ctx util.CmdContext, opts *setupGitOptions) (err error) {
}

// second configure the actual helper for this host
configureCmd, err := gitClient.Command(ctx.Context(),
configureCmd, err := gitClient.Command(
ctx.Context(),
"config", "--global", "--add",
credHelperKey,
fmt.Sprintf("!%s auth git-credential", gitClient.GetAzDoPath()),
Expand All @@ -134,7 +135,8 @@ func setupGitRun(ctx util.CmdContext, opts *setupGitOptions) (err error) {
return err
}

configureCmd, err = gitClient.Command(ctx.Context(),
configureCmd, err = gitClient.Command(
ctx.Context(),
"config", "--global", "--add",
fmt.Sprintf("%s.useHttpPath", strings.TrimSuffix(credHelperKey, ".helper")),
"true",
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/boards/area/project/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ func runList(ctx util.CmdContext, opts *listOptions) error {
return fmt.Errorf("failed to construct request: %w", err)
}

zap.L().Debug("listing project area paths",
zap.L().Debug(
"listing project area paths",
zap.String("organization", scope.Organization),
zap.String("project", scope.Project),
zap.String("path", strings.TrimSpace(opts.path)),
Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/pipelines/pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/tmeckel/azdo-cli/internal/cmd/pipelines/agent"
"github.com/tmeckel/azdo-cli/internal/cmd/pipelines/list"
"github.com/tmeckel/azdo-cli/internal/cmd/pipelines/pool"
"github.com/tmeckel/azdo-cli/internal/cmd/pipelines/runs"
"github.com/tmeckel/azdo-cli/internal/cmd/pipelines/variablegroup"
"github.com/tmeckel/azdo-cli/internal/cmd/util"
)
Expand All @@ -17,6 +18,7 @@ func NewCmd(ctx util.CmdContext) *cobra.Command {
}

cmd.AddCommand(list.NewCmd(ctx))
cmd.AddCommand(runs.NewCmd(ctx))
cmd.AddCommand(variablegroup.NewCmd(ctx))
cmd.AddCommand(agent.NewCmd(ctx))
cmd.AddCommand(pool.NewCmd(ctx))
Expand Down
Loading
Loading