Skip to content

Commit f58652b

Browse files
authored
metadata-service[lib]: introduce a rolloutConfiguration field to the metadata model (#44504)
## What Closes https://github.com/airbytehq/airbyte-internal-issues/issues/9249 ## How * Add a `RolloutConfiguration.yaml` model * Reference it in the connector metadata model under the `releases` field. * Introduce a `isReleaseCandidate` field in under `releases` * Re-generated pydantic models
1 parent 367f706 commit f58652b

11 files changed

+147
-7
lines changed

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorMetadataDefinitionV0.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Any, Dict, List, Optional, Union
88
from uuid import UUID
99

10-
from pydantic import AnyUrl, BaseModel, Extra, Field, constr
10+
from pydantic import AnyUrl, BaseModel, Extra, Field, conint, constr
1111
from typing_extensions import Literal
1212

1313

@@ -96,6 +96,21 @@ class JobType(BaseModel):
9696
)
9797

9898

99+
class RolloutConfiguration(BaseModel):
100+
class Config:
101+
extra = Extra.forbid
102+
103+
initialPercentage: Optional[conint(ge=0, le=100)] = Field(
104+
0, description="The percentage of users that should receive the new version initially."
105+
)
106+
maxPercentage: Optional[conint(ge=0, le=100)] = Field(
107+
50, description="The percentage of users who should receive the release candidate during the test phase before full rollout."
108+
)
109+
advanceDelayMinutes: Optional[conint(ge=10)] = Field(
110+
10, description="The number of minutes to wait before advancing the rollout percentage."
111+
)
112+
113+
99114
class StreamBreakingChangeScope(BaseModel):
100115
class Config:
101116
extra = Extra.forbid
@@ -268,6 +283,8 @@ class ConnectorReleases(BaseModel):
268283
class Config:
269284
extra = Extra.forbid
270285

286+
isReleaseCandidate: Optional[bool] = Field(False, description="Whether the release is eligible to be a release candidate.")
287+
rolloutConfiguration: Optional[RolloutConfiguration] = None
271288
breakingChanges: ConnectorBreakingChanges
272289
migrationDocumentationUrl: Optional[AnyUrl] = Field(
273290
None,

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorRegistryDestinationDefinition.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Any, Dict, List, Optional, Union
88
from uuid import UUID
99

10-
from pydantic import AnyUrl, BaseModel, Extra, Field, constr
10+
from pydantic import AnyUrl, BaseModel, Extra, Field, conint, constr
1111
from typing_extensions import Literal
1212

1313

@@ -63,6 +63,21 @@ class Config:
6363
)
6464

6565

66+
class RolloutConfiguration(BaseModel):
67+
class Config:
68+
extra = Extra.forbid
69+
70+
initialPercentage: Optional[conint(ge=0, le=100)] = Field(
71+
0, description="The percentage of users that should receive the new version initially."
72+
)
73+
maxPercentage: Optional[conint(ge=0, le=100)] = Field(
74+
50, description="The percentage of users who should receive the release candidate during the test phase before full rollout."
75+
)
76+
advanceDelayMinutes: Optional[conint(ge=10)] = Field(
77+
10, description="The number of minutes to wait before advancing the rollout percentage."
78+
)
79+
80+
6681
class StreamBreakingChangeScope(BaseModel):
6782
class Config:
6883
extra = Extra.forbid
@@ -175,6 +190,8 @@ class ConnectorReleases(BaseModel):
175190
class Config:
176191
extra = Extra.forbid
177192

193+
isReleaseCandidate: Optional[bool] = Field(False, description="Whether the release is eligible to be a release candidate.")
194+
rolloutConfiguration: Optional[RolloutConfiguration] = None
178195
breakingChanges: ConnectorBreakingChanges
179196
migrationDocumentationUrl: Optional[AnyUrl] = Field(
180197
None,

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorRegistrySourceDefinition.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Any, Dict, List, Optional, Union
88
from uuid import UUID
99

10-
from pydantic import AnyUrl, BaseModel, Extra, Field, constr
10+
from pydantic import AnyUrl, BaseModel, Extra, Field, conint, constr
1111
from typing_extensions import Literal
1212

1313

@@ -59,6 +59,21 @@ class Config:
5959
)
6060

6161

62+
class RolloutConfiguration(BaseModel):
63+
class Config:
64+
extra = Extra.forbid
65+
66+
initialPercentage: Optional[conint(ge=0, le=100)] = Field(
67+
0, description="The percentage of users that should receive the new version initially."
68+
)
69+
maxPercentage: Optional[conint(ge=0, le=100)] = Field(
70+
50, description="The percentage of users who should receive the release candidate during the test phase before full rollout."
71+
)
72+
advanceDelayMinutes: Optional[conint(ge=10)] = Field(
73+
10, description="The number of minutes to wait before advancing the rollout percentage."
74+
)
75+
76+
6277
class StreamBreakingChangeScope(BaseModel):
6378
class Config:
6479
extra = Extra.forbid
@@ -171,6 +186,8 @@ class ConnectorReleases(BaseModel):
171186
class Config:
172187
extra = Extra.forbid
173188

189+
isReleaseCandidate: Optional[bool] = Field(False, description="Whether the release is eligible to be a release candidate.")
190+
rolloutConfiguration: Optional[RolloutConfiguration] = None
174191
breakingChanges: ConnectorBreakingChanges
175192
migrationDocumentationUrl: Optional[AnyUrl] = Field(
176193
None,

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorRegistryV0.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Any, Dict, List, Optional, Union
88
from uuid import UUID
99

10-
from pydantic import AnyUrl, BaseModel, Extra, Field, constr
10+
from pydantic import AnyUrl, BaseModel, Extra, Field, conint, constr
1111
from typing_extensions import Literal
1212

1313

@@ -63,6 +63,21 @@ class Config:
6363
)
6464

6565

66+
class RolloutConfiguration(BaseModel):
67+
class Config:
68+
extra = Extra.forbid
69+
70+
initialPercentage: Optional[conint(ge=0, le=100)] = Field(
71+
0, description="The percentage of users that should receive the new version initially."
72+
)
73+
maxPercentage: Optional[conint(ge=0, le=100)] = Field(
74+
50, description="The percentage of users who should receive the release candidate during the test phase before full rollout."
75+
)
76+
advanceDelayMinutes: Optional[conint(ge=10)] = Field(
77+
10, description="The number of minutes to wait before advancing the rollout percentage."
78+
)
79+
80+
6681
class StreamBreakingChangeScope(BaseModel):
6782
class Config:
6883
extra = Extra.forbid
@@ -185,6 +200,8 @@ class ConnectorReleases(BaseModel):
185200
class Config:
186201
extra = Extra.forbid
187202

203+
isReleaseCandidate: Optional[bool] = Field(False, description="Whether the release is eligible to be a release candidate.")
204+
rolloutConfiguration: Optional[RolloutConfiguration] = None
188205
breakingChanges: ConnectorBreakingChanges
189206
migrationDocumentationUrl: Optional[AnyUrl] = Field(
190207
None,

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorReleases.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,22 @@
66
from datetime import date
77
from typing import Any, Dict, List, Optional
88

9-
from pydantic import AnyUrl, BaseModel, Extra, Field, constr
9+
from pydantic import AnyUrl, BaseModel, Extra, Field, conint, constr
10+
11+
12+
class RolloutConfiguration(BaseModel):
13+
class Config:
14+
extra = Extra.forbid
15+
16+
initialPercentage: Optional[conint(ge=0, le=100)] = Field(
17+
0, description="The percentage of users that should receive the new version initially."
18+
)
19+
maxPercentage: Optional[conint(ge=0, le=100)] = Field(
20+
50, description="The percentage of users who should receive the release candidate during the test phase before full rollout."
21+
)
22+
advanceDelayMinutes: Optional[conint(ge=10)] = Field(
23+
10, description="The number of minutes to wait before advancing the rollout percentage."
24+
)
1025

1126

1227
class StreamBreakingChangeScope(BaseModel):
@@ -51,6 +66,8 @@ class ConnectorReleases(BaseModel):
5166
class Config:
5267
extra = Extra.forbid
5368

69+
isReleaseCandidate: Optional[bool] = Field(False, description="Whether the release is eligible to be a release candidate.")
70+
rolloutConfiguration: Optional[RolloutConfiguration] = None
5471
breakingChanges: ConnectorBreakingChanges
5572
migrationDocumentationUrl: Optional[AnyUrl] = Field(
5673
None,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# generated by datamodel-codegen:
2+
# filename: RolloutConfiguration.yaml
3+
4+
from __future__ import annotations
5+
6+
from typing import Optional
7+
8+
from pydantic import BaseModel, Extra, Field, conint
9+
10+
11+
class RolloutConfiguration(BaseModel):
12+
class Config:
13+
extra = Extra.forbid
14+
15+
initialPercentage: Optional[conint(ge=0, le=100)] = Field(
16+
0, description="The percentage of users that should receive the new version initially."
17+
)
18+
maxPercentage: Optional[conint(ge=0, le=100)] = Field(
19+
50, description="The percentage of users who should receive the release candidate during the test phase before full rollout."
20+
)
21+
advanceDelayMinutes: Optional[conint(ge=10)] = Field(
22+
10, description="The number of minutes to wait before advancing the rollout percentage."
23+
)

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .ReleaseStage import *
2020
from .RemoteRegistries import *
2121
from .ResourceRequirements import *
22+
from .RolloutConfiguration import *
2223
from .Secret import *
2324
from .SecretStore import *
2425
from .SourceFileInfo import *

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/ConnectorReleases.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ additionalProperties: false
88
required:
99
- breakingChanges
1010
properties:
11+
isReleaseCandidate:
12+
description: Whether the release is eligible to be a release candidate.
13+
type: boolean
14+
default: false
15+
rolloutConfiguration:
16+
$ref: RolloutConfiguration.yaml
1117
breakingChanges:
1218
$ref: "#/definitions/ConnectorBreakingChanges"
1319
migrationDocumentationUrl:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
"$schema": http://json-schema.org/draft-07/schema#
3+
"$id": https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/RolloutConfiguration.yaml
4+
title: RolloutConfiguration
5+
description: configuration for the rollout of a connector
6+
type: object
7+
additionalProperties: false
8+
properties:
9+
initialPercentage:
10+
type: integer
11+
minimum: 0
12+
maximum: 100
13+
default: 0
14+
description: The percentage of users that should receive the new version initially.
15+
maxPercentage:
16+
type: integer
17+
minimum: 0
18+
maximum: 100
19+
default: 50
20+
description: The percentage of users who should receive the release candidate during the test phase before full rollout.
21+
advanceDelayMinutes:
22+
type: integer
23+
minimum: 10
24+
default: 10
25+
description: The number of minutes to wait before advancing the rollout percentage.

airbyte-ci/connectors/metadata_service/lib/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "metadata-service"
3-
version = "0.10.3"
3+
version = "0.11.0"
44
description = ""
55
authors = ["Ben Church <[email protected]>"]
66
readme = "README.md"

airbyte-ci/connectors/metadata_service/lib/tests/test_transform.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def have_same_keys(dict1, dict2, omitted_keys=None):
5959
def test_transform_to_json_does_not_mutate_keys(valid_metadata_upload_files, valid_metadata_yaml_files):
6060
all_valid_metadata_files = valid_metadata_upload_files + valid_metadata_yaml_files
6161

62-
fields_with_defaults = ["data.supportsRefreshes"]
62+
fields_with_defaults = ["data.supportsRefreshes", "data.releases.isReleaseCandidate"]
6363

6464
for file_path in all_valid_metadata_files:
6565
metadata_file_path = pathlib.Path(file_path)

0 commit comments

Comments
 (0)