Skip to content

Commit

Permalink
fix: Add missing extra field to ContainerRegistryNode GQL query, …
Browse files Browse the repository at this point in the history
…mutations (#3208) (#3220)

Co-authored-by: Gyubong Lee <[email protected]>
  • Loading branch information
lablup-octodog and jopemachine authored Dec 6, 2024
1 parent d353a74 commit 8ab8155
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
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 @@ -1296,6 +1296,9 @@ type ContainerRegistryNode implements Node {

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

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

"""Added in 24.09.0."""
Expand Down Expand Up @@ -1507,6 +1510,9 @@ type Mutations {

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

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

Expand Down Expand Up @@ -1536,6 +1542,9 @@ type Mutations {

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

"""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 @@ -275,6 +275,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 @@ -357,6 +358,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 @@ -387,6 +389,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 @@ -401,6 +404,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 @@ -419,6 +423,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 @@ -453,6 +458,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 @@ -468,6 +474,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 @@ -485,6 +492,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

0 comments on commit 8ab8155

Please sign in to comment.