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

fix: Add missing extra field to ContainerRegistryNode GQL query, mutations #3208

Merged
merged 2 commits into from
Dec 6, 2024
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
1 change: 1 addition & 0 deletions changes/3208.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing `extra` field to `ContainerRegistryNode` GQL query, mutations.
9 changes: 9 additions & 0 deletions src/ai/backend/manager/api/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,9 @@

"""Added in 24.09.0."""
ssl_verify: Boolean

"""Added in 24.09.3."""
extra: JSONString

Check notice on line 1507 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'extra' was added to object type 'ContainerRegistryNode'

Field 'extra' was added to object type 'ContainerRegistryNode'
}

"""Added in 24.09.0."""
Expand Down Expand Up @@ -1719,6 +1722,9 @@

"""Added in 24.09.0."""
create_container_registry_node(
"""Added in 24.09.3."""
extra: JSONString

Check warning on line 1726 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Argument 'extra: JSONString' added to field 'Mutations.create_container_registry_node'

Adding a new argument to an existing field may involve a change in resolve function logic that potentially may cause some side effects.

"""Added in 24.09.0."""
is_global: Boolean

Expand Down Expand Up @@ -1748,6 +1754,9 @@

"""Added in 24.09.0."""
modify_container_registry_node(
"""Added in 24.09.3."""
extra: JSONString

Check warning on line 1758 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Argument 'extra: JSONString' added to field 'Mutations.modify_container_registry_node'

Adding a new argument to an existing field may involve a change in resolve function logic that potentially may cause some side effects.

"""Object id. Can be either global id or object id. Added in 24.09.0."""
id: String!

Expand Down
8 changes: 8 additions & 0 deletions src/ai/backend/manager/models/container_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class Meta:
username = graphene.String(description="Added in 24.09.0.")
password = graphene.String(description="Added in 24.09.0.")
ssl_verify = graphene.Boolean(description="Added in 24.09.0.")
extra = graphene.JSONString(description="Added in 24.09.3.")

_queryfilter_fieldspec: dict[str, FieldSpecItem] = {
"row_id": ("id", None),
Expand Down Expand Up @@ -363,6 +364,7 @@ def from_row(cls, ctx: GraphQueryContext, row: ContainerRegistryRow) -> Containe
password=PASSWORD_PLACEHOLDER if row.password is not None else None,
ssl_verify=row.ssl_verify,
is_global=row.is_global,
extra=row.extra,
)


Expand Down Expand Up @@ -393,6 +395,7 @@ class Arguments:
username = graphene.String(description="Added in 24.09.0.")
password = graphene.String(description="Added in 24.09.0.")
ssl_verify = graphene.Boolean(description="Added in 24.09.0.")
extra = graphene.JSONString(description="Added in 24.09.3.")

@classmethod
async def mutate(
Expand All @@ -407,6 +410,7 @@ async def mutate(
username: str | UndefinedType = Undefined,
password: str | UndefinedType = Undefined,
ssl_verify: bool | UndefinedType = Undefined,
extra: dict | UndefinedType = Undefined,
) -> CreateContainerRegistryNode:
ctx: GraphQueryContext = info.context

Expand All @@ -425,6 +429,7 @@ def _set_if_set(name: str, val: Any) -> None:
_set_if_set("password", password)
_set_if_set("ssl_verify", ssl_verify)
_set_if_set("is_global", is_global)
_set_if_set("extra", extra)

async with ctx.db.begin_session() as db_session:
reg_row = ContainerRegistryRow(**input_config)
Expand Down Expand Up @@ -459,6 +464,7 @@ class Arguments:
username = graphene.String(description="Added in 24.09.0.")
password = graphene.String(description="Added in 24.09.0.")
ssl_verify = graphene.Boolean(description="Added in 24.09.0.")
extra = graphene.JSONString(description="Added in 24.09.3.")

@classmethod
async def mutate(
Expand All @@ -474,6 +480,7 @@ async def mutate(
username: str | UndefinedType = Undefined,
password: str | UndefinedType = Undefined,
ssl_verify: bool | UndefinedType = Undefined,
extra: dict | UndefinedType = Undefined,
) -> ModifyContainerRegistryNode:
ctx: GraphQueryContext = info.context

Expand All @@ -491,6 +498,7 @@ def _set_if_set(name: str, val: Any) -> None:
_set_if_set("project", project)
_set_if_set("ssl_verify", ssl_verify)
_set_if_set("is_global", is_global)
_set_if_set("extra", extra)

_, _id = AsyncNode.resolve_global_id(info, id)
reg_id = uuid.UUID(_id) if _id else uuid.UUID(id)
Expand Down
Loading