Skip to content
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

Added Cluster Queue/Jobs example to GraphQL Cookbook #2224

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
58 changes: 58 additions & 0 deletions pages/apis/graphql/graphql_cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,64 @@ mutation {
}
```

## Clusters

A collection of common tasks with clusters using the GraphQL API.

### List cluster queues
james2791 marked this conversation as resolved.
Show resolved Hide resolved

List the first 20 cluster queues' key and ID for the first 10 clusters in the organisation
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be a bit simpler/clearer. Maybe:

Suggested change
List the first 20 cluster queues' key and ID for the first 10 clusters in the organisation
For the first 10 clusters in an organization, list the key and ID of the first 20 cluster queues.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the latest commit 👍, TY @mbelton-buildkite


```graphql
query getClusterQueues {
organization(slug: "organization-slug") {
clusters(first:10){
edges{
node{
name
queues(first:20){
edges{
node{
key
id
}
}
}
}
}
}
}
}
```

### List jobs as part of a specific cluster queue
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this still keep the right meaning?

Suggested change
### List jobs as part of a specific cluster queue
### List jobs in a cluster queue

Just looking if there's a sensible way to shorten it a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the latest commit 👍, TY @mbelton-buildkite


List the first 20 jobs as part of a cluster queue in the `RUNNING` [job state](/docs/apis/graphql/schemas/enum/jobstates).

```graphql
query getClusterQueueJobs {
organization(slug:"organization-slug"){
jobs(first: 20, clusterQueue:"cluster-queue-id", state:[RUNNING]) {
edges{
node{
... on JobTypeCommand{
state
uuid
build{
id
number
pipeline{
name
}
}
}
}
}
}
}
}
```

## Organizations

A collection of common tasks with organizations using the GraphQL API.
Expand Down