From c3a9a4ffde00013a8f66819a18e2d1561c29f839 Mon Sep 17 00:00:00 2001 From: Ben Church <ben@airbyte.io> Date: Fri, 6 Oct 2023 15:06:30 -0700 Subject: [PATCH] Error loudly if airbyte-ci is out of date with code on master (#31087) ## Overview Error instead of warn when airbyte-ci out of date as if airbyte-ci is out of date you are in an invalid state --- airbyte-ci/connectors/pipelines/README.md | 1 + .../pipelines/pipelines/commands/airbyte_ci.py | 18 +++++++++++++----- airbyte-ci/connectors/pipelines/pyproject.toml | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/airbyte-ci/connectors/pipelines/README.md b/airbyte-ci/connectors/pipelines/README.md index c24f3bdab49b..796e16c12c61 100644 --- a/airbyte-ci/connectors/pipelines/README.md +++ b/airbyte-ci/connectors/pipelines/README.md @@ -398,6 +398,7 @@ This command runs the Python tests for a airbyte-ci poetry package. ## Changelog | Version | PR | Description | |---------| --------------------------------------------------------- |-----------------------------------------------------------------------------------------------------------| +| 1.4.6 |[ #31087](https://github.com/airbytehq/airbyte/pull/31087) | Throw error if airbyte-ci tools is out of date | | 1.4.5 | [#31133](https://github.com/airbytehq/airbyte/pull/31133) | Fix bug when building containers using `with_integration_base_java_and_normalization`. | | 1.4.4 | [#30743](https://github.com/airbytehq/airbyte/pull/30743) | Add `--disable-report-auto-open` and `--use-host-gradle-dist-tar` to allow gradle integration. | | 1.4.3 | [#30595](https://github.com/airbytehq/airbyte/pull/30595) | Add --version and version check | diff --git a/airbyte-ci/connectors/pipelines/pipelines/commands/airbyte_ci.py b/airbyte-ci/connectors/pipelines/pipelines/commands/airbyte_ci.py index 7cd3d5590348..b14a4d1a6bad 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/commands/airbyte_ci.py +++ b/airbyte-ci/connectors/pipelines/pipelines/commands/airbyte_ci.py @@ -35,19 +35,27 @@ def check_up_to_date() -> bool: """Check if the installed version of pipelines is up to date.""" - # get the version of the latest release, which is just in the pyproject.toml file of the pipelines package - # as this is an internal tool, we don't need to check for the latest version on PyPI latest_version = get_latest_version() if latest_version != __installed_version__: - main_logger.warning(f"pipelines is not up to date. Installed version: {__installed_version__}. Latest version: {latest_version}") - main_logger.warning("Please run `pipx reinstall pipelines` to upgrade to the latest version.") - return False + upgrade_error_message = f""" + 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 + + airbyte-ci is not up to date. Installed version: {__installed_version__}. Latest version: {latest_version} + Please run `pipx reinstall pipelines` to upgrade to the latest version. + + 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 + """ + raise Exception(upgrade_error_message) main_logger.info(f"pipelines is up to date. Installed version: {__installed_version__}. Latest version: {latest_version}") return True def get_latest_version() -> str: + """ + Get the version of the latest release, which is just in the pyproject.toml file of the pipelines package + as this is an internal tool, we don't need to check for the latest version on PyPI + """ path_to_pyproject_toml = LOCAL_PIPELINE_PACKAGE_PATH + "pyproject.toml" with open(path_to_pyproject_toml, "r") as f: for line in f.readlines(): diff --git a/airbyte-ci/connectors/pipelines/pyproject.toml b/airbyte-ci/connectors/pipelines/pyproject.toml index 7e28fb07aafd..d2a286ac8f30 100644 --- a/airbyte-ci/connectors/pipelines/pyproject.toml +++ b/airbyte-ci/connectors/pipelines/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pipelines" -version = "1.4.5" +version = "1.4.6" description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines" authors = ["Airbyte <contact@airbyte.io>"]