Skip to content

Commit

Permalink
Error loudly if airbyte-ci is out of date with code on master (#31087)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
bnchrch committed Oct 6, 2023
1 parent e3e231e commit c3a9a4f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 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 @@ -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 |
Expand Down
18 changes: 13 additions & 5 deletions airbyte-ci/connectors/pipelines/pipelines/commands/airbyte_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
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 = "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>"]

Expand Down

0 comments on commit c3a9a4f

Please sign in to comment.