Skip to content

Commit 3c6b12d

Browse files
alafanecherestephane-airbyte
authored andcommitted
airbyte-ci: rename StepResult.output artifact to StepResult.output
1 parent 3d521a4 commit 3c6b12d

File tree

18 files changed

+61
-69
lines changed

18 files changed

+61
-69
lines changed

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/steps/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def run_connector_build_pipeline(context: ConnectorContext, semaphore: any
4747
async with semaphore:
4848
async with context:
4949
build_result = await run_connector_build(context)
50-
per_platform_built_containers = build_result.output_artifact
50+
per_platform_built_containers = build_result.output
5151
step_results.append(build_result)
5252
if context.is_local and build_result.status is StepStatus.SUCCESS:
5353
load_image_result = await LoadContainerToLocalDockerHost(context, per_platform_built_containers, image_tag).run()

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/steps/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def _run(self, *args: Any) -> StepResult:
4848
f"The {self.context.connector.technical_name} docker image "
4949
f"was successfully built for platform(s) {', '.join(self.build_platforms)}"
5050
)
51-
return StepResult(step=self, status=StepStatus.SUCCESS, stdout=success_message, output_artifact=build_results_per_platform)
51+
return StepResult(step=self, status=StepStatus.SUCCESS, stdout=success_message, output=build_results_per_platform)
5252

5353
async def _build_connector(self, platform: Platform, *args: Any, **kwargs: Any) -> Container:
5454
"""Implement the generation of the image for the platform and return the corresponding container.

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/steps/java_connectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def run_connector_build(context: ConnectorContext) -> StepResult:
5959
build_connector_tar_result = await BuildConnectorDistributionTar(context).run()
6060
if build_connector_tar_result.status is not StepStatus.SUCCESS:
6161
return build_connector_tar_result
62-
dist_dir = await build_connector_tar_result.output_artifact.directory(dist_tar_directory_path(context))
62+
dist_dir = await build_connector_tar_result.output.directory(dist_tar_directory_path(context))
6363
return await BuildConnectorImages(context).run(dist_dir)
6464

6565

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/steps/normalization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ async def _run(self) -> StepResult:
3636
build_normalization_container = normalization.with_normalization(self.context, self.build_platform)
3737
else:
3838
build_normalization_container = self.context.dagger_client.container().from_(self.normalization_image)
39-
return StepResult(step=self, status=StepStatus.SUCCESS, output_artifact=build_normalization_container)
39+
return StepResult(step=self, status=StepStatus.SUCCESS, output=build_normalization_container)

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/bump_version/pipeline.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def _run(self) -> StepResult:
5555
step=self,
5656
status=StepStatus.SKIPPED,
5757
stdout="Connector does not have a documentation file.",
58-
output_artifact=self.repo_dir,
58+
output=self.repo_dir,
5959
)
6060
try:
6161
updated_doc = self.add_changelog_entry(doc_path.read_text())
@@ -64,14 +64,14 @@ async def _run(self) -> StepResult:
6464
step=self,
6565
status=StepStatus.FAILURE,
6666
stdout=f"Could not add changelog entry: {e}",
67-
output_artifact=self.repo_dir,
67+
output=self.repo_dir,
6868
)
6969
updated_repo_dir = self.repo_dir.with_new_file(str(doc_path), contents=updated_doc)
7070
return StepResult(
7171
step=self,
7272
status=StepStatus.SUCCESS,
7373
stdout=f"Added changelog entry to {doc_path}",
74-
output_artifact=updated_repo_dir,
74+
output=updated_repo_dir,
7575
)
7676

7777
def find_line_index_for_new_entry(self, markdown_text: str) -> int:
@@ -118,7 +118,7 @@ async def _run(self) -> StepResult:
118118
step=self,
119119
status=StepStatus.SKIPPED,
120120
stdout="Can't retrieve the connector current version.",
121-
output_artifact=self.repo_dir,
121+
output=self.repo_dir,
122122
)
123123
updated_metadata_str = self.get_metadata_with_bumped_version(current_version, self.new_version, current_metadata_str)
124124
repo_dir_with_updated_metadata = metadata_change_helpers.get_repo_dir_with_updated_metadata_str(
@@ -134,7 +134,7 @@ async def _run(self) -> StepResult:
134134
step=self,
135135
status=StepStatus.SUCCESS,
136136
stdout=f"Updated dockerImageTag from {current_version} to {self.new_version} in {metadata_path}",
137-
output_artifact=repo_dir_with_updated_metadata,
137+
output=repo_dir_with_updated_metadata,
138138
)
139139

140140

@@ -164,7 +164,7 @@ async def run_connector_version_bump_pipeline(
164164
new_version,
165165
)
166166
update_docker_image_tag_in_metadata_result = await update_docker_image_tag_in_metadata.run()
167-
repo_dir_with_updated_metadata = update_docker_image_tag_in_metadata_result.output_artifact
167+
repo_dir_with_updated_metadata = update_docker_image_tag_in_metadata_result.output
168168
steps_results.append(update_docker_image_tag_in_metadata_result)
169169

170170
add_changelog_entry = AddChangelogEntry(
@@ -176,7 +176,7 @@ async def run_connector_version_bump_pipeline(
176176
)
177177
add_changelog_entry_result = await add_changelog_entry.run()
178178
steps_results.append(add_changelog_entry_result)
179-
final_repo_dir = add_changelog_entry_result.output_artifact
179+
final_repo_dir = add_changelog_entry_result.output
180180
await og_repo_dir.diff(final_repo_dir).export(str(git.get_git_repo_path()))
181181
report = ConnectorReport(context, steps_results, name="CONNECTOR VERSION BUMP RESULTS")
182182
context.report = report

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_base_image/pipeline.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async def _run(self) -> StepResult:
6464
step=self,
6565
status=StepStatus.SKIPPED,
6666
stdout="Could not find a base image for this connector language.",
67-
output_artifact=self.repo_dir,
67+
output=self.repo_dir,
6868
)
6969

7070
metadata_path = self.context.connector.metadata_file_path
@@ -76,15 +76,15 @@ async def _run(self) -> StepResult:
7676
step=self,
7777
status=StepStatus.SKIPPED,
7878
stdout="Connector does not have a base image metadata field.",
79-
output_artifact=self.repo_dir,
79+
output=self.repo_dir,
8080
)
8181

8282
if current_base_image_address == latest_base_image_address:
8383
return StepResult(
8484
step=self,
8585
status=StepStatus.SKIPPED,
8686
stdout="Connector already uses latest base image",
87-
output_artifact=self.repo_dir,
87+
output=self.repo_dir,
8888
)
8989
updated_metadata = self.update_base_image_in_metadata(current_metadata, latest_base_image_address)
9090
updated_repo_dir = metadata_change_helpers.get_repo_dir_with_updated_metadata(self.repo_dir, metadata_path, updated_metadata)
@@ -93,7 +93,7 @@ async def _run(self) -> StepResult:
9393
step=self,
9494
status=StepStatus.SUCCESS,
9595
stdout=f"Updated base image to {latest_base_image_address} in {metadata_path}",
96-
output_artifact=updated_repo_dir,
96+
output=updated_repo_dir,
9797
)
9898

9999

@@ -146,7 +146,7 @@ async def _run(self) -> StepResult:
146146
step=self,
147147
status=StepStatus.SKIPPED,
148148
stdout="Connector does not have a documentation file.",
149-
output_artifact=self.repo_dir,
149+
output=self.repo_dir,
150150
)
151151
current_readme = await (await self.context.get_connector_dir(include=["README.md"])).file("README.md").contents()
152152
try:
@@ -156,14 +156,14 @@ async def _run(self) -> StepResult:
156156
step=self,
157157
status=StepStatus.FAILURE,
158158
stdout=str(e),
159-
output_artifact=self.repo_dir,
159+
output=self.repo_dir,
160160
)
161161
updated_repo_dir = await self.repo_dir.with_new_file(str(readme_path), contents=updated_readme)
162162
return StepResult(
163163
step=self,
164164
status=StepStatus.SUCCESS,
165165
stdout=f"Added build instructions to {readme_path}",
166-
output_artifact=updated_repo_dir,
166+
output=updated_repo_dir,
167167
)
168168

169169
def add_build_instructions(self, og_doc_content: str) -> str:
@@ -276,7 +276,7 @@ async def run_connector_base_image_upgrade_pipeline(context: ConnectorContext, s
276276
)
277277
update_base_image_in_metadata_result = await update_base_image_in_metadata.run()
278278
steps_results.append(update_base_image_in_metadata_result)
279-
final_repo_dir = update_base_image_in_metadata_result.output_artifact
279+
final_repo_dir = update_base_image_in_metadata_result.output
280280
await og_repo_dir.diff(final_repo_dir).export(str(git.get_git_repo_path()))
281281
report = ConnectorReport(context, steps_results, name="BASE IMAGE UPGRADE RESULTS")
282282
context.report = report
@@ -324,7 +324,7 @@ async def run_connector_migration_to_base_image_pipeline(
324324
new_version = get_bumped_version(context.connector.version, "patch")
325325
bump_version_in_metadata = BumpDockerImageTagInMetadata(
326326
context,
327-
update_base_image_in_metadata_result.output_artifact,
327+
update_base_image_in_metadata_result.output,
328328
new_version,
329329
)
330330
bump_version_in_metadata_result = await bump_version_in_metadata.run()
@@ -333,7 +333,7 @@ async def run_connector_migration_to_base_image_pipeline(
333333
# ADD CHANGELOG ENTRY
334334
add_changelog_entry = AddChangelogEntry(
335335
context,
336-
bump_version_in_metadata_result.output_artifact,
336+
bump_version_in_metadata_result.output,
337337
new_version,
338338
"Base image migration: remove Dockerfile and use the python-connector-base image",
339339
pull_request_number,
@@ -344,13 +344,13 @@ async def run_connector_migration_to_base_image_pipeline(
344344
# UPDATE DOC
345345
add_build_instructions_to_doc = AddBuildInstructionsToReadme(
346346
context,
347-
add_changelog_entry_result.output_artifact,
347+
add_changelog_entry_result.output,
348348
)
349349
add_build_instructions_to_doc_results = await add_build_instructions_to_doc.run()
350350
steps_results.append(add_build_instructions_to_doc_results)
351351

352352
# EXPORT MODIFIED FILES BACK TO HOST
353-
final_repo_dir = add_build_instructions_to_doc_results.output_artifact
353+
final_repo_dir = add_build_instructions_to_doc_results.output
354354
await og_repo_dir.diff(final_repo_dir).export(str(git.get_git_repo_path()))
355355
report = ConnectorReport(context, steps_results, name="MIGRATE TO BASE IMAGE RESULTS")
356356
context.report = report

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/publish/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def create_connector_report(results: List[StepResult]) -> ConnectorReport:
313313
if build_connector_results.status is not StepStatus.SUCCESS:
314314
return create_connector_report(results)
315315

316-
built_connector_platform_variants = list(build_connector_results.output_artifact.values())
316+
built_connector_platform_variants = list(build_connector_results.output.values())
317317
push_connector_image_results = await PushConnectorImageToRegistry(context).run(built_connector_platform_variants)
318318
results.append(push_connector_image_results)
319319

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/steps/java_connectors.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ def _create_integration_step_args_factory(context: ConnectorContext) -> Callable
9090

9191
async def _create_integration_step_args(results: RESULTS_DICT) -> Dict[str, Optional[File]]:
9292

93-
connector_container = results["build"].output_artifact[LOCAL_BUILD_PLATFORM]
93+
connector_container = results["build"].output[LOCAL_BUILD_PLATFORM]
9494
connector_image_tar_file, _ = await export_container_to_tarball(context, connector_container, LOCAL_BUILD_PLATFORM)
9595

9696
if context.connector.supports_normalization:
9797
tar_file_name = f"{context.connector.normalization_repository}_{context.git_revision}.tar"
9898
build_normalization_results = results["build_normalization"]
9999

100-
normalization_container = build_normalization_results.output_artifact
100+
normalization_container = build_normalization_results.output
101101
normalization_tar_file, _ = await export_container_to_tarball(
102102
context, normalization_container, LOCAL_BUILD_PLATFORM, tar_file_name=tar_file_name
103103
)
@@ -138,9 +138,7 @@ def _get_acceptance_test_steps(context: ConnectorContext) -> List[StepToRun]:
138138
StepToRun(
139139
id=CONNECTOR_TEST_STEP_ID.ACCEPTANCE,
140140
step=AcceptanceTests(context, True),
141-
args=lambda results: {
142-
"connector_under_test_container": results[CONNECTOR_TEST_STEP_ID.BUILD].output_artifact[LOCAL_BUILD_PLATFORM]
143-
},
141+
args=lambda results: {"connector_under_test_container": results[CONNECTOR_TEST_STEP_ID.BUILD].output[LOCAL_BUILD_PLATFORM]},
144142
depends_on=[CONNECTOR_TEST_STEP_ID.BUILD],
145143
),
146144
]
@@ -159,7 +157,7 @@ def get_test_steps(context: ConnectorContext) -> STEP_TREE:
159157
id=CONNECTOR_TEST_STEP_ID.BUILD,
160158
step=BuildConnectorImages(context),
161159
args=lambda results: {
162-
"dist_dir": results[CONNECTOR_TEST_STEP_ID.BUILD_TAR].output_artifact.directory(dist_tar_directory_path(context))
160+
"dist_dir": results[CONNECTOR_TEST_STEP_ID.BUILD_TAR].output.directory(dist_tar_directory_path(context))
163161
},
164162
depends_on=[CONNECTOR_TEST_STEP_ID.BUILD_TAR],
165163
),

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/steps/python_connectors.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,29 +253,27 @@ def get_test_steps(context: ConnectorContext) -> STEP_TREE:
253253
StepToRun(
254254
id=CONNECTOR_TEST_STEP_ID.UNIT,
255255
step=UnitTests(context),
256-
args=lambda results: {"connector_under_test": results[CONNECTOR_TEST_STEP_ID.BUILD].output_artifact[LOCAL_BUILD_PLATFORM]},
256+
args=lambda results: {"connector_under_test": results[CONNECTOR_TEST_STEP_ID.BUILD].output[LOCAL_BUILD_PLATFORM]},
257257
depends_on=[CONNECTOR_TEST_STEP_ID.BUILD],
258258
)
259259
],
260260
[
261261
StepToRun(
262262
id=CONNECTOR_TEST_STEP_ID.INTEGRATION,
263263
step=IntegrationTests(context),
264-
args=lambda results: {"connector_under_test": results[CONNECTOR_TEST_STEP_ID.BUILD].output_artifact[LOCAL_BUILD_PLATFORM]},
264+
args=lambda results: {"connector_under_test": results[CONNECTOR_TEST_STEP_ID.BUILD].output[LOCAL_BUILD_PLATFORM]},
265265
depends_on=[CONNECTOR_TEST_STEP_ID.BUILD],
266266
),
267267
StepToRun(
268268
id=CONNECTOR_TEST_STEP_ID.AIRBYTE_LIB_VALIDATION,
269269
step=AirbyteLibValidation(context),
270-
args=lambda results: {"connector_under_test": results[CONNECTOR_TEST_STEP_ID.BUILD].output_artifact[LOCAL_BUILD_PLATFORM]},
270+
args=lambda results: {"connector_under_test": results[CONNECTOR_TEST_STEP_ID.BUILD].output[LOCAL_BUILD_PLATFORM]},
271271
depends_on=[CONNECTOR_TEST_STEP_ID.BUILD],
272272
),
273273
StepToRun(
274274
id=CONNECTOR_TEST_STEP_ID.ACCEPTANCE,
275275
step=AcceptanceTests(context, context.concurrent_cat),
276-
args=lambda results: {
277-
"connector_under_test_container": results[CONNECTOR_TEST_STEP_ID.BUILD].output_artifact[LOCAL_BUILD_PLATFORM]
278-
},
276+
args=lambda results: {"connector_under_test_container": results[CONNECTOR_TEST_STEP_ID.BUILD].output[LOCAL_BUILD_PLATFORM]},
279277
depends_on=[CONNECTOR_TEST_STEP_ID.BUILD],
280278
),
281279
],

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/upgrade_cdk/pipeline.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ async def _run(self) -> StepResult:
5959
status=StepStatus.FAILURE,
6060
stdout="Could not export diff to local git repo.",
6161
)
62-
return StepResult(
63-
step=self, status=StepStatus.SUCCESS, stdout=f"Updated CDK version to {self.new_version}", output_artifact=diff
64-
)
62+
return StepResult(step=self, status=StepStatus.SUCCESS, stdout=f"Updated CDK version to {self.new_version}", output=diff)
6563
except ValueError as e:
6664
return StepResult(
6765
step=self,

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/format_command.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def invoke(self, ctx: click.Context, click_pipeline_context: ClickPipeline
124124
container = self.get_format_container_fn(dagger_client, dir_to_format)
125125
command_result = await self.get_format_command_result(dagger_client, container, dir_to_format)
126126

127-
if (formatted_code_dir := command_result.output_artifact) and self.export_formatted_code:
127+
if (formatted_code_dir := command_result.output) and self.export_formatted_code:
128128
await formatted_code_dir.export(self.LOCAL_REPO_PATH)
129129

130130
if self._enable_logging:
@@ -203,9 +203,7 @@ async def get_format_command_result(
203203
if await dir_with_modified_files.entries():
204204
modified_files = await list_files_in_directory(dagger_client, dir_with_modified_files)
205205
self.logger.debug(f"Modified files: {modified_files}")
206-
return CommandResult(
207-
command=self, status=StepStatus.FAILURE, stdout=stdout, stderr=stderr, output_artifact=dir_with_modified_files
208-
)
206+
return CommandResult(command=self, status=StepStatus.FAILURE, stdout=stdout, stderr=stderr, output=dir_with_modified_files)
209207
return CommandResult(command=self, status=StepStatus.SUCCESS, stdout=stdout, stderr=stderr)
210208
except dagger.ExecError as e:
211209
return CommandResult(command=self, status=StepStatus.FAILURE, stderr=e.stderr, stdout=e.stdout, exc_info=e)

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/gradle.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,23 @@ async def _run(self, *args: Any, **kwargs: Any) -> StepResult:
202202

203203
return await self.get_step_result(gradle_container, artifacts)
204204

205-
async def get_step_result(self, container: Container, output_artifacts: List[Artifact]) -> StepResult:
205+
async def get_step_result(self, container: Container, outputs: List[Artifact]) -> StepResult:
206206
step_result = await super().get_step_result(container)
207207
# Decorate with test report, if applicable.
208208
return StepResult(
209209
step=step_result.step,
210210
status=step_result.status,
211211
stdout=step_result.stdout,
212212
stderr=step_result.stderr,
213-
output_artifact=step_result.output_artifact,
214-
artifacts=output_artifacts,
213+
output=step_result.output,
214+
artifacts=outputs,
215215
)
216216

217217
async def _collect_test_logs(self, gradle_container: Container) -> Optional[Artifact]:
218218
"""
219219
Exports the java docs from the container into the host filesystem.
220220
The docs in the container are expected to be in build/test-logs, and will end up test-artifact directory by default
221-
One can change the destination directory by setting the output_artifacts
221+
One can change the destination directory by setting the outputs
222222
"""
223223
test_logs_dir_name = "test-logs"
224224
if test_logs_dir_name not in await gradle_container.directory(f"{self.context.connector.code_directory}/build").entries():
@@ -247,7 +247,7 @@ async def _collect_test_results(self, gradle_container: Container) -> Optional[A
247247
Exports the junit test reports from the container into the host filesystem.
248248
The docs in the container are expected to be in build/test-results, and will end up test-artifact directory by default
249249
Only the XML files generated by junit are downloaded into the host filesystem
250-
One can change the destination directory by setting the output_artifacts
250+
One can change the destination directory by setting the outputs
251251
"""
252252
test_results_dir_name = "test-results"
253253
if test_results_dir_name not in await gradle_container.directory(f"{self.context.connector.code_directory}/build").entries():

0 commit comments

Comments
 (0)