-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Move tools/ci_* projects to airbyte-ci, update to use Poetry, bump to python 3.10 #27957
Conversation
airbyte-ci/ci/ci_pipelines/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pipelines/airbyte-ci are now their own package
airbyte-ci/ci/ci_pipelines/README.md
Outdated
Once pipx is installed, navigate to the root directory of the project, then run: | ||
|
||
```bash | ||
pipx install airbyte-ci/ci/ci_pipelines/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The installation is one line
packages = [{ include = "ci_credentials" }] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 3.10 all around!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ci_credentials is installed on GHA workflows that are running 3.9
. Can we keep compatibility of ci_credentials
with 3.9
while suggesting use of 3.10
though .python-version
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to keep the version diff between local and ci? Could this be another source of behavior mismatches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm, seems like we bumped most things as we went along, except .github/workflows/connector-performance-command.yml
for some reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I think that was a miss on my part.
I ended up going with 3.10 everywhere as it seems that there were no issues encountered while running these tools as 3.10
requests = "^2.28.2" | ||
click = "^8.1.3" | ||
pyyaml = "^6.0" | ||
ci_common_utils = { path = "../ci_common_utils", develop = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go ahead with this we will need to update the local dependency resolution right?
Yes it is!
Totally
I'm not against it but I'm not familiar with it. Is it providing dependency isolation while not requiring the use of a python virtualenv? I'm 👍 , but if poetry has a builtin way to achieve the same I'd prefer to stick to poetry (I'm not too familiar with it too..)
So in this
My suggestion would be to:
|
@alafanechere Thanks for the swift reply and glad to hear this is in the same direction you had in mind!
Poetry doesntly have a good way to "install" these cli tools. So we'd have to run the airbyte-ci by cd airbyte-ci/ci/ci_pipelines
poetry install
poetry run airbyte-ci Note: we'd also have to update all the paths to work from this folder not root However thats where pipx comes in its purpose built to install cli tools in an isolated way. This should let us have our customers (connector devs) install It also interfaces with pyproject.toml and the lockfiles perfectly!
These all sound great. Would you mind if we moved the refactor of Just so I can get this in with minimal conflicts 😅 What I can do is rename these to remove ci and place them all under e.g. |
Allright, let's use pipx!
👍
Do you have an opinion about this? |
I LOVE this. Thats my opinion. I think were in a great spot to do that. Also it would be useful in the metadata_service |
source-faker test report (commit
|
Step | Result |
---|---|
Validate airbyte-integrations/connectors/source-faker/metadata.yaml | ✅ |
Connector version semver check | ✅ |
Connector version increment check | ❌ |
QA checks | ✅ |
Code format checks | ✅ |
Connector package install | ✅ |
Build source-faker docker image for platform linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ✅ |
Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command
airbyte-ci connectors --name=source-faker test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@airbytehq/connector-operations Gut check: We should remove this.
There is
- no use of
ci_sonar_qube
in code - no use of
ci_changes_detection
in code - the is one use of
ci_sonar_qube
in a github action: https://github.com/airbytehq/airbyte/pull/27957/files#diff-c46f6e02d0050829e4e9f4a4bd0eb29da35853e0786b7ddf348f665085c561da - But that action is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never heard of this, if that helps anything!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deleted.
See: https://github.com/airbytehq/airbyte/pull/27957/files#r1272911875
@airbytehq/connector-operations This is ready for review! Most of this is
The only file with net new logic is how we install pipx and use it in the pipelines here ...tor_ops/pipelines/actions/environments.py → ...pelines/pipelines/actions/environments.py Please let me know what you think, I would like this to be a speedy merge to avoid conflicts! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installation was a breeze! Messed around with formatting a source, testing the orchestrator and metadata lib. I'm still not sure (via READMEs alone, and after a quick non-deep perusal of CI changes) how to run tests for the pipelines.
Some non-blocking feedback - I think we should merge this improvement before trying to tweak anything much more:
- I was able to run the QA engine from where it lives with the instructions provided. I find it sort of weird it lives under airbyte ci but has a separate installation and run process
- It looks like the README of airbyte-ci lives under
airbyte-ci/connectors/pipelines
- i'd expect it to live underairbyte-ci
or maybeairbyte-ci/connectors
. I guess this makes sense because of the install command beingpipx install airbyte-ci/connectors/pipelines
... this installation path confuses me since i expect airbyte-ci to be able to run the metadata service as well (and the qa engine as described above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never heard of this, if that helps anything!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to unblock but could you please checkout the report path problem and the dev mode story? 😄
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
dagger-io = "^0.6.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before installing airbyte-ci
with pipx
I've set my current Python version to Python 3.10.8 with pyenv
:
pyenv shell 3.10.8
.
In this python version I already had installed dagger-io in a different version: 0.5.4
.
When I ran pipx install airbyte-ci/connectors/pipelines/
it did not update the dagger version.
When I retried without pyenv shell
the install worked correctly and the correct version is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it. This is expected!
https://github.com/pypa/pipx#how-is-it-different-from-pip
pipx actually installs all dependencies for the specified package in a directory isolated from your current python environment.
The packages you have in you global env or pyenv will have no effect on the package dependencies install with pipx and vice versa
So it makes sense to me that the dagger-io version in your pyenv shell didnt change.
But can you tell me what you ran to get the version for dagger-io?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the pipx behavior is great when you're not using pyenv shell
before:
When you use pyenv shell 3.10.8
I think that pyenv does also create/reuse a venv for the specific python version you use.
In my context, my pyenv venv had an old dagger-io version that I installed with pip install dagger-io
When I ran pipx install
after running pyenv shell 3.10.8
the install works but when running airbyte-ci
the "old" dagger version was used and not the one declared in airbyte-ci
.
It's a strange behavior I can't really explain: my suggestion is just to keep in mind that the pyenv shell + pipx
combo can lead to strange install and not suggest developer to use pyenv shell
.
TLDR: don't change anything on the doc, the classic install path look stable, but in case of installation issue by developers we should just keep in mind to ask them how they installed and use Python 3.10.8.
@@ -16,7 +16,8 @@ CONNECTOR_DIR="$ROOT_DIR/airbyte-integrations/connectors/$CONNECTOR_NAME" | |||
|
|||
if [ -n "$FETCH_SECRETS" ]; then | |||
cd $ROOT_DIR | |||
VERSION=dev $ROOT_DIR/tools/.venv/bin/ci_credentials $CONNECTOR_NAME write-to-storage || true | |||
pipx install airbyte-ci/connectors/ci_credentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this script install pipx directly to make it self contained?
@@ -1,30 +1,50 @@ | |||
# Airbyte CI CLI | |||
# Airbyte CI CLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a link in the airbyte-ci/README.md
to this file?
``` | ||
|
||
This command installs `airbyte-ci` and makes it globally available in your terminal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think folks should open a new terminal or source their bash profile to get airbyte-ci
in their path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate a bit more on the why and what an ideal install instruction looks like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that after you run pipx install the airbyte-ci
the CLI is not directly available in the PATH.
I suggest to add something like: Open a new terminal session or source your bash profile to make
airbyte-ci available in your path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm it should be immediately available on your path 🤔
It wasnt for you?
If you are developing on pipelines, we recommend installing airbyte-ci in editable mode: | ||
|
||
```bash | ||
pipx install airbyte-ci/connectors/pipelines/ --force --editable | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit skeptical about this approach for dev mode.
When developping on airbyte-ci I'm used to iterate in a virtual environment and have clear output of the dependencies installed when in run pip install. When using pipx install
it's not obvious where is this environment located and how it would clash with an other non editable install.
I installed in editable mode, changed a dependency version, reinstall in editable mode: the dependency was not upgraded.
To check what dependencies are install I use pip freeze
. In this context, as I'm not in a virtual environment the pip freeze outputs my globally installed packages, not the airbyte-ci
specific one.
TLDR: in dev mode I'd like to explicitely switch to a python virtualenv and get an easy way to check what deps are installed.
The solution here is probably to use poetry instead of pipx for development:
pyenv shell 3.10.8 # I can't make poetry work with python 3.9, I face this issue https://github.com/python-poetry/poetry/issues/7695
poetry install # this creates a virtualenv (.venv) in the package folder
poetry shell # activates the virtualenv
cd ../../..
airbyte-ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thumbs up to using poetry for dev!
Seems a lot more approachable and intuitive :)
@@ -32,6 +32,6 @@ | |||
GRADLE_CACHE_PATH = "/root/.gradle/caches" | |||
GRADLE_BUILD_CACHE_PATH = f"{GRADLE_CACHE_PATH}/build-cache-1" | |||
GRADLE_READ_ONLY_DEPENDENCY_CACHE_PATH = "/root/gradle_dependency_cache" | |||
LOCAL_REPORTS_PATH_ROOT = "tools/ci_connector_ops/pipeline_reports/" | |||
LOCAL_REPORTS_PATH_ROOT = "airbyte-ci/connectors/pipelines/pipeline_reports/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path looks good, but when I execute an empty pipeline_reports
folder is created at:
airbyte-ci/airbyte-ci/connectors/pipelines/pipeline_reports
And the actual test reports are written a very nested location:
airbyte-ci/connectors/pipelinespipeline_reports/airbyte-ci/connectors/test/manual/bnchrch_ci_poetry-pipelines/1690300788/26884cd0dbe194727b5982e7b67c96e7b60573a6/dagger.log
Something is probably missing up with the path in reports.py
or context.py
:
local_path = anyio.Path(f"{LOCAL_REPORTS_PATH_ROOT}/{self.report_output_prefix}/{filename}")
await local_path.parents[0].mkdir(parents=True, exist_ok=True)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh good catch. Let me see whats going on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see whats going on
empty pipeline_reports folder created
This is an is issue with where we create the report directory which is only discovered if you run the airbyte-ci
cmd not in the root.
Ill move this closer to us writing the log
And the actual test reports are written a very nested location:
It is very nested but expected
The log path airbyte-ci/connectors/pipelines/pipeline_reports/airbyte-ci/connectors/test/manual/bnchrch_ci_poetry-pipelines/1690300788/26884cd0dbe194727b5982e7b67c96e7b60573a6/dagger.log
has three discrete parts
- The parent folder
airbyte-ci/connectors/pipelines/
- The airbyte-ci defined path structure
airbyte-ci/connectors/test/
- the git info
manual/bnchrch_ci_poetry-pipelines/1690300788/26884cd0dbe194727b5982e7b67c96e7b60573a6
so you will note that #1 and #2 are nearly identical.
and that turns out is a coincidence.
The airbyte-ci defined path structure is derived from the click command hierarchy airbyte-ci connectors test --name=...
requests = "^2.28.2" | ||
connector-ops = {path = "../connector_ops"} | ||
toml = "^0.10.2" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some testing dependencies? (feel free to copy the one that were in the main setup.py
source-faker test report (commit
|
Step | Result |
---|---|
Validate airbyte-integrations/connectors/source-faker/metadata.yaml | ✅ |
Connector version semver check | ✅ |
Connector version increment check | ❌ |
QA checks | ✅ |
Code format checks | ✅ |
Connector package install | ✅ |
Build source-faker docker image for platform linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ✅ |
Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command
airbyte-ci connectors --name=source-faker test
Just updated the branch to
Im going to run some test pipelines now to ensure everything works as planned |
source-faker test report (commit
|
Step | Result |
---|---|
Validate airbyte-integrations/connectors/source-faker/metadata.yaml | ✅ |
Connector version semver check | ✅ |
Connector version increment check | ❌ |
QA checks | ✅ |
Code format checks | ✅ |
Connector package install | ✅ |
Build source-faker docker image for platform linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ✅ |
Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command
airbyte-ci connectors --name=source-faker test
Test
prepublish Edit: everything passed, moving onto reverting source-faker changes |
@bnchrch I pushed a gitignore change to ignore the legacy pipeline reports paths. Otherwise a |
@bnchrch I updated the poetry lock following the test dependency declaration. |
What
Now to install airbyte-ci all you have to run is
Notes for reviewer
@alafanechere I would love to get your take on this being the
airbyte-ci
tzar.ci
andconnectors
at the top ofairbyte-ci
still feel awkward is there a better way?Left TODO
ci_code_validator
closes #25170
closes #27865