Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connectors-ci: wrap airbyte-ci in dagger run #28869

Merged

Conversation

alafanechere
Copy link
Contributor

@alafanechere alafanechere commented Jul 31, 2023

What

Closes #28690
The Dagger CLI offers a nice Terminal UI for Dagger pipeline execution.
To use this Terminal UI user should wrap pipeline execution with dagger run airbyte-ci.
We don't want our user to care about the Dagger CLI installation and to remind wrapping the CLI with dagger run.

How

  • Create a airbyte-ci-bare command: this is our original, unwrapped airbyte-ci command
  • Declare airbyte-ci command as the call of the main function of the dagger_run.py module. It
    • Installs the correct Dagger CLI version according to the SDK version
    • Run dagger run airbyte-ci-bare + arguments in a subprocess
  • Make the CI use airbyte-ci-bare to not alter the CI behavior we've had so far.

🚨 User Impact 🚨

Users should benefit from this by updating their airbyte-ci installation with : pipx install airbyte-ci/connectors/pipelines

REVIEWERS PLEASE TRY THIS AT HOME
Screen Shot 2023-07-31 at 18 28 27

@alafanechere alafanechere requested review from a team and cpdeethree July 31, 2023 16:28
Copy link
Contributor

@cpdeethree cpdeethree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Contributor

@bnchrch bnchrch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question!

@@ -29,4 +29,5 @@ pytest = "^6.2.5"
pytest-mock = "^3.10.0"

[tool.poetry.scripts]
airbyte-ci = "pipelines.commands.airbyte_ci:airbyte_ci"
airbyte-ci-bare = "pipelines.commands.airbyte_ci:airbyte_ci"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love that were brining in dagger run.

One question though why use airbyte-ci-bare and no airbyte-ci --disable-dagger-run ...?

Seems like that is possible and better ergonomics for users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we need an executable that dagger run calls right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewording: We can indeed have airbyte-ci --disable-dagger-run easily. But I'm not sure we can easily get rid of a second executable. The airbyte-ci-bare use won't be documented...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bnchrch I'll try some things out to check how we could not rely on a second executable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't too strong of a suggestion.

Also I think I could've worded it better as discouraging the direct use of airbyte-ci-bare by

  1. updating our CI tools to use airbyte-ci --disable-dagger-run as the prefered pattern
  2. updating the airbyte-ci code to check for the --disable-dagger-run flag

For example

import argparse
import sys

def run_command(command_list: List[str]) -> None:
    try:
        subprocess.run(command_list + sys.argv[1:], check=True)
    except subprocess.CalledProcessError as e:
        sys.exit(e.returncode)

parser = argparse.ArgumentParser()
parser.add_argument('--disable-dagger-run', type=bool, default=False)
def main():
    args = parser.parse_args()
    command_to_run = ["airbyte-ci-internal"]
    if not args.disable_dagger_run:
        command_to_run = ["dagger", "run"] + command_to_run
        check_dagger_cli_install()

    run_command(command_to_run)
    ```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed airbyte-ci-bare to airbyte-ci-internal.
You can use airbyte-ci --no-tui to disable the terminal UI (and directly use airbyte-ci-internal).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bnchrch I'll keep running airbyte-ci-internal in the GHA action to prevent any regression

@alafanechere alafanechere merged commit 6103ce1 into master Aug 1, 2023
23 checks passed
@alafanechere alafanechere deleted the augustin/connectors-ci/wrap-airbyte-ci-in-dagger-run branch August 1, 2023 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update local airbyte-ci to use Dagger run
3 participants