Skip to content

Commit

Permalink
Adding cluster queue support for hosted agents (#596)
Browse files Browse the repository at this point in the history
* initial push for hosted agent queue

* updated graphql queries to match hosted schema

* Set enough hosted config to create a queue

* Getting the hosted agents to a create a store state

* Padding out the update queue functionality

* Adding the xcodeVersion capabilities

* Finishing off the XCode work

* Bring the project back closer to the original

* Regenerate the full graph schema

* Update the image naming to better align with the API

* Fixes for linting and tests

* Updating the state properly for the update method

---------

Co-authored-by: Ben McNicholl <[email protected]>
Co-authored-by: Matthew Borden <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 27a34b7 commit 93508bc
Show file tree
Hide file tree
Showing 10 changed files with 1,207 additions and 99 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ schema:
go get github.com/suessflorian/gqlfetch/gqlfetch
go get github.com/Khan/genqlient/[email protected]
go get github.com/vektah/gqlparser/v2/[email protected]
go run github.com/suessflorian/gqlfetch/gqlfetch -endpoint https://graphql.buildkite.com/v1 -header "Authorization=Bearer $${BUILDKITE_GRAPHQL_TOKEN}" > schema.graphql
go run github.com/suessflorian/gqlfetch/gqlfetch -endpoint "$${BUILDKITE_GRAPHQL_URL:-https://graphql.buildkite.com/v1}" -header "Authorization=Bearer $${BUILDKITE_API_TOKEN:-$$BUILDKITE_GRAPHQL_TOKEN}" > schema.graphql

# Generate the GraphQL code
generate: schema
Expand Down
489 changes: 478 additions & 11 deletions buildkite/generated.go

Large diffs are not rendered by default.

74 changes: 41 additions & 33 deletions buildkite/graphql/cluster_queue.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
fragment HostedAgentsQueueSettingsValues on HostedAgentQueueSettings {
instanceShape {
architecture
machineType
memory
name
size
vcpu
}
platformSettings {
linux {
agentImageRef
}
macos {
xcodeVersion
}
}
}

fragment ClusterQueueValues on ClusterQueue {
id
uuid
Expand All @@ -8,6 +27,10 @@ fragment ClusterQueueValues on ClusterQueue {
id
uuid
}
hosted
hostedAgents {
...HostedAgentsQueueSettingsValues
}
}

query getClusterQueues($orgSlug: ID!, $id: ID!) {
Expand All @@ -34,18 +57,21 @@ query getClusterQueues($orgSlug: ID!, $id: ID!) {
}

mutation createClusterQueue(
$organizationId: ID!,
$clusterId: ID!,
$key: String!,
$organizationId: ID!
$clusterId: ID!
$key: String!
# @genqlient(pointer: true)
$description: String
# @genqlient(pointer: true)
$hostedAgents: HostedAgentsQueueSettingsCreateInput
) {
clusterQueueCreate(
input: {
organizationId: $organizationId
clusterId: $clusterId,
clusterId: $clusterId
key: $key
description: $description
hostedAgents: $hostedAgents
}
) {
clusterQueue {
Expand All @@ -55,16 +81,19 @@ mutation createClusterQueue(
}

mutation updateClusterQueue(
$organizationId: ID!,
$id: ID!,
$organizationId: ID!
$id: ID!
# @genqlient(pointer: true)
$description: String
# @genqlient(pointer: true)
$hostedAgents: HostedAgentsQueueSettingsUpdateInput
) {
clusterQueueUpdate(
input: {
organizationId: $organizationId
id: $id
description: $description
hostedAgents: $hostedAgents
}
) {
clusterQueue {
Expand All @@ -82,41 +111,20 @@ mutation updateClusterQueue(
}
}

mutation deleteClusterQueue(
$organizationId: ID!,
$id: ID!,
){
clusterQueueDelete(
input: {
organizationId: $organizationId
id: $id
}
) {
mutation deleteClusterQueue($organizationId: ID!, $id: ID!) {
clusterQueueDelete(input: { organizationId: $organizationId, id: $id }) {
clientMutationId
}
}

mutation pauseDispatchClusterQueue (
$id: ID!,
) {
clusterQueuePauseDispatch(
input: {
id: $id
}
) {
mutation pauseDispatchClusterQueue($id: ID!) {
clusterQueuePauseDispatch(input: { id: $id }) {
clientMutationId
}
}

mutation resumeDispatchClusterQueue (
$id: ID!
) {
clusterQueueResumeDispatch(
input: {
id: $id
}
){
mutation resumeDispatchClusterQueue($id: ID!) {
clusterQueueResumeDispatch(input: { id: $id }) {
clientMutationId
}
}

Loading

0 comments on commit 93508bc

Please sign in to comment.