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

airbyte-ci: remove connector secrets hack for --is-local #33972

Merged

Conversation

postamar
Copy link
Contributor

@postamar postamar commented Jan 5, 2024

See #33582 (comment) for context. I tested that these changes worked by running airbyte-ci locally.

Copy link

vercel bot commented Jan 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2024 3:41pm

@postamar postamar marked this pull request as ready for review January 5, 2024 14:56
@postamar postamar requested a review from a team January 5, 2024 14:56
@@ -24,6 +23,8 @@ def deploy(ctx: click.Context) -> None:
@deploy.command(cls=DaggerPipelineCommand, name="orchestrator", help="Deploy the metadata service orchestrator to production")
@click.pass_context
async def deploy_orchestrator(ctx: click.Context) -> None:
# Import locally to speed up CLI.
from pipelines.airbyte_ci.metadata.pipeline import run_metadata_orchestrator_deploy_pipeline
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This shaves 4 seconds off of the execution time for airbyte-ci --help, bringing it down to under a second.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a clue why the import is so slow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not this import in particular, it's all of the transitive imports in pipeline.py and beyond.

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

As get_file_contents is made to be reused in different contexts on different containers I believe a solution to check file exsistence relying on dagger api instead of sh could be more stable.

@@ -24,6 +23,8 @@ def deploy(ctx: click.Context) -> None:
@deploy.command(cls=DaggerPipelineCommand, name="orchestrator", help="Deploy the metadata service orchestrator to production")
@click.pass_context
async def deploy_orchestrator(ctx: click.Context) -> None:
# Import locally to speed up CLI.
from pipelines.airbyte_ci.metadata.pipeline import run_metadata_orchestrator_deploy_pipeline
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a clue why the import is so slow?

# this error could come from a network issue
raise
return None
nonexistence = await container.with_exec(["sh", "-c", f"[ -f '{path}' ] || echo '{path} does not exist'"]).stdout()
Copy link
Contributor

Choose a reason for hiding this comment

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

This consider that:

  • sh is available in the container
  • the container entrypoint is not overidden (you could set skip_entrypoint=True on thewith_exec)

I'd find it more robust to only rely on Dagger's API to check file existence.
Maybe something like:

  • Inferring the directory from the path
  • Call await container.directory(directory_path).entries() and check if the file is in the returned list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I didn't think this one through. Good catch!

@postamar
Copy link
Contributor Author

postamar commented Jan 5, 2024

Thanks for the review, this is ready for another look.

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

LGTM, thank you, our dagger UI runs will be greener 🙏

Comment on lines +104 to +107
dir_name, file_name = os.path.split(path)
if file_name not in set(await container.directory(dir_name).entries()):
return None
return await container.file(path).contents()
Copy link
Contributor

Choose a reason for hiding this comment

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

The precondition here is that path is a file path and not a dir path, I'm not sure its enforced but I'm fine with it, Dagger will raise an exception if the path leads to a directory.

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 think that raising an exception is fine in that case, get_file_contents really makes no sense if applied to a directory.

@postamar
Copy link
Contributor Author

postamar commented Jan 9, 2024

Thanks for the review! I resolved the conflicts, waiting for ✅

@postamar
Copy link
Contributor Author

Bypassing branch protections owing to the failing formatting job, which is failing because it can't provision the right kind of runner or something.

@postamar postamar merged commit bbdd6d8 into master Jan 10, 2024
20 of 21 checks passed
@postamar postamar deleted the postamar/airbyte-ci-remove-local-secrets-special-casing branch January 10, 2024 16:48
Copy link

sentry-io bot commented Jan 18, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ExceptionGroup: 2 exceptions were raised in the task group: anyio._backends._asyncio in __aexit__ View Issue

Did you find this useful? React with a 👍 or 👎

jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
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.

None yet

2 participants