-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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]: new check on python certified connector to validate their base image use #30527
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
beef79d
to
d7c6437
Compare
a1b0d77
to
2d3ee2e
Compare
2c2de0c
to
26837a3
Compare
@@ -282,3 +282,28 @@ async def _build_connector_acceptance_test(self, connector_under_test_image_tar: | |||
) | |||
|
|||
return cat_container.with_unix_socket("/var/run/docker.sock", self.context.dagger_client.host().unix_socket("/var/run/docker.sock")) | |||
|
|||
|
|||
class CheckBaseImageIsUsed(Step): |
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.
😍 a simple work of art! Loved reading this.
2d3ee2e
to
f6e7ab5
Compare
26837a3
to
11a3b4a
Compare
f6e7ab5
to
4b23511
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
11a3b4a
to
168f10d
Compare
8258a4e
to
175e2d0
Compare
168f10d
to
c013a0a
Compare
92be7ae
to
276f1b0
Compare
8fe96a6
to
de9a417
Compare
276f1b0
to
404346d
Compare
de9a417
to
29ded3d
Compare
is_certified = self.context.connector.metadata.get("supportLevel") | ||
if not is_certified: | ||
self.skip("Connector is not certified, it does not require the use of our base image.") |
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.
@alafanechere I think I'm missing something here - does this actually give us whether the connector is certified? As far as I can tell this will give us certified
, community
or None
(since it's optional).
If the supportLevel is set to community
, then is_certified = 'community'
if not is_certified = False
and we run the check on community connectors 🤔
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.
ahah nice catch, thank you
if not is_using_base_image: | ||
return StepResult( | ||
self, | ||
StepStatus.FAILURE, | ||
stdout="Connector is certified but does not use our base image. Please set connectorBuildOptions.baseImage in the connector metadata.", | ||
) | ||
has_dockerfile = "Dockerfile" in await (await self.context.get_connector_dir(include="Dockerfile")).entries() | ||
if has_dockerfile: | ||
return StepResult( | ||
self, | ||
StepStatus.FAILURE, | ||
stdout="Connector is certified but is still using a Dockerfile. Please remove the Dockerfile and set connectorBuildOptions.baseImage in the connector metadata.", | ||
) |
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.
Nit: we'll first tell people to set the baseImage. Then if they run again with both, we tell them to remove the dockerfile and set the base image. They shouldn't be able to reach this second conditional if the base image is already set, so we can remove and set connectorBuildOptions.baseImage in the connector metadata
from the stdout
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 added a suggestion in the error message to run the migration command. It will make sure that metadata is using the base image and that the dockerfile is removed.
StepStatus.FAILURE, | ||
stdout="Connector is certified but does not use our base image. Please set connectorBuildOptions.baseImage in the connector metadata.", | ||
) | ||
has_dockerfile = "Dockerfile" in await (await self.context.get_connector_dir(include="Dockerfile")).entries() |
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 reuse the property from this PR here?
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.
We could but it's. a bit less reliable.
When we call the has_dockerfile
property on the Connector object it examines the current filesystem to check for the existence of a dockerfile.
When we check with get_connector_dir
we check within a Directory
object that is build by the context. The get_connector_dir
implementation can change in the future to fetch the connector code from elsewhere (another container or a remote git branch returned by Dagger as a Directory).
This is why we have an explicit check here.
But unfortunately this rule is not consistently used in the rest of the codebase, has accessing the Connector attribute is far more simple.
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.
Would it be possible/worth it to to make the attribute call get_connector_dir
as well?
a728afd
to
fcecb62
Compare
29ded3d
to
b30969f
Compare
Coverage report for source-postgres
|
fc12ce3
to
d88e299
Compare
source-google-sheets test report (commit
|
Step | Result |
---|---|
Build source-google-sheets docker image for platform(s) linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ✅ |
Check our base image is used | ❌ |
Code format checks | ✅ |
Validate metadata for source-google-sheets | ✅ |
Connector version semver check | ✅ |
QA checks | ✅ |
☁️ View runs for commit in Dagger Cloud
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-google-sheets test
source-file test report (commit
|
Step | Result |
---|---|
Build source-file docker image for platform(s) linux/x86_64 | ✅ |
Unit tests | ✅ |
Integration tests | ✅ |
Acceptance tests | ✅ |
Check our base image is used | ✅ |
Code format checks | ✅ |
Validate metadata for source-file | ✅ |
Connector version semver check | ✅ |
QA checks | ✅ |
☁️ View runs for commit in Dagger Cloud
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-file test
d88e299
to
be10db7
Compare
☝️ These test results confirm the correct behavior of the new check. |
8c05020
to
817e796
Compare
…ir base image use
817e796
to
787ec57
Compare
…ir base image use (airbytehq#30527) Co-authored-by: alafanechere <[email protected]>
What
Closes #30239
We want to make sure a certified python connectors does not pass the test if:
connectorBuildOptions.baseImage
in its metadata.yamlHow
CheckBaseImageIsUsed