Skip to content

Commit

Permalink
airbyte-ci: run poetry check before poetry install on poetry pack…
Browse files Browse the repository at this point in the history
…age install (airbytehq#35212)
  • Loading branch information
alafanechere authored and jatinyadav-cc committed Feb 26, 2024
1 parent 9290b31 commit 817aa12
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions airbyte-ci/connectors/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ E.G.: running Poe tasks on the modified internal packages of the current branch:

| Version | PR | Description |
| ------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 4.2.1 | [#35204](https://github.com/airbytehq/airbyte/pull/35204) | Run `poetry check` before `poetry install` on poetry package install. |
| 4.2.0 | [#35103](https://github.com/airbytehq/airbyte/pull/35103) | Java 21 support. |
| 4.1.4 | [#35039](https://github.com/airbytehq/airbyte/pull/35039) | Fix bug which prevented gradle test reports from being added. |
| 4.1.3 | [#35010](https://github.com/airbytehq/airbyte/pull/35010) | Use `poetry install --no-root` in the builder container. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ async def _run(self, *args: Any) -> StepResult:
connector = await self._build_connector(platform, *args)
try:
await connector.with_exec(["spec"])
except ExecError:
except ExecError as e:
return StepResult(
step=self, status=StepStatus.FAILURE, stderr=f"Failed to run spec on the connector built for platform {platform}."
step=self, status=StepStatus.FAILURE, stderr=str(e), stdout=f"Failed to run the spec command on the connector container for platform {platform}."
)
build_results_per_platform[platform] = connector
except QueryError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def _create_builder_container(self, base_container: Container) -> Containe
Returns:
Container: The builder container, with installed dependencies.
"""
ONLY_BUILD_FILES = ["pyproject.toml", "poetry.lock", "poetry.toml", "setup.py", "requirements.txt"]
ONLY_BUILD_FILES = ["pyproject.toml", "poetry.lock", "poetry.toml", "setup.py", "requirements.txt", "README.md"]

builder = await with_python_connector_installed(
self.context,
Expand All @@ -54,7 +54,6 @@ async def _create_builder_container(self, base_container: Container) -> Containe
install_root_package=False,
include=ONLY_BUILD_FILES
)

return builder

async def _build_from_base_image(self, platform: Platform) -> Container:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,20 @@ def _install_python_dependencies_from_poetry(
pip_install_poetry_cmd = ["pip", "install", "poetry"]
poetry_disable_virtual_env_cmd = ["poetry", "config", "virtualenvs.create", "false"]
poetry_install_cmd = ["poetry", "install"]
poetry_check_cmd = ["poetry", "check"]
if not install_root_package:
poetry_install_cmd += ["--no-root"]
if additional_dependency_groups:
for group in additional_dependency_groups:
poetry_install_cmd += ["--with", group]
else:
poetry_install_cmd += ["--only", "main"]
return container.with_exec(pip_install_poetry_cmd).with_exec(poetry_disable_virtual_env_cmd).with_exec(poetry_install_cmd)
return (
container.with_exec(pip_install_poetry_cmd)
.with_exec(poetry_disable_virtual_env_cmd)
.with_exec(poetry_check_cmd)
.with_exec(poetry_install_cmd)
)


async def with_installed_python_package(
Expand Down
2 changes: 1 addition & 1 deletion airbyte-ci/connectors/pipelines/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pipelines"
version = "4.2.0"
version = "4.2.1"
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
authors = ["Airbyte <contact@airbyte.io>"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ async def test__run_validation_fail(
result = await AirbyteLibValidation(context_for_invalid_connector)._run(mocker.MagicMock())
assert isinstance(result, StepResult)
assert result.status == StepStatus.FAILURE
assert "does not appear to be a Python project" in result.stderr
assert "is not installable" in result.stderr

0 comments on commit 817aa12

Please sign in to comment.