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

Save specs to source/dest definitions on create and update #7367

Merged
merged 8 commits into from
Oct 28, 2021

Conversation

lmossman
Copy link
Contributor

@lmossman lmossman commented Oct 26, 2021

What

Resolves #7135.

Adds logic to the source/dest definition create/update API endpoints to fetch the specs from the connector container and save the spec to the definition struct in the db.

How

Uses the existing schedulerSynchronousClient in the two handlers to fetch the spec from the connector container on create or on update if the image tag has changed or the spec is not present in the db.

Recommended reading order

  1. Non-test files
  2. Test files

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions
  • Connector added to connector index like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.

@github-actions github-actions bot added area/platform issues related to the platform area/server labels Oct 26, 2021
@lmossman lmossman temporarily deployed to more-secrets October 26, 2021 00:48 Inactive
@lmossman lmossman temporarily deployed to more-secrets October 26, 2021 00:52 Inactive
@lmossman lmossman temporarily deployed to more-secrets October 26, 2021 16:55 Inactive
@lmossman lmossman temporarily deployed to more-secrets October 26, 2021 20:43 Inactive
Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

looks great! one quick question on whether we should be still using the image validator at all.

destinationDefinitionUpdate.getDockerImageTag());

final boolean imageTagHasChanged = !currentDestination.getDockerImageTag().equals(destinationDefinitionUpdate.getDockerImageTag());
// TODO (lmossman): remove null spec condition when the spec field becomes required on the
Copy link
Contributor

Choose a reason for hiding this comment

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

nice! good call out.

@@ -104,7 +108,12 @@ public DestinationDefinitionRead getDestinationDefinition(final DestinationDefin

public DestinationDefinitionRead createDestinationDefinition(final DestinationDefinitionCreate destinationDefinitionCreate)
throws JsonValidationException, IOException {
imageValidator.assertValidIntegrationImage(destinationDefinitionCreate.getDockerRepository(),
imageValidator.assertValidIntegrationImage(
Copy link
Contributor

Choose a reason for hiding this comment

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

is the image validator doing anything useful at this point? it seems almost entirely duplicative at this point with fetching the spec on the next line. what do you think about just totally removing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good catch, yeah it does seem pretty redundant now that we are fetching and using the spec in this function. Let's sweep it!

@lmossman lmossman temporarily deployed to more-secrets October 27, 2021 00:31 Inactive
Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

once you get the build passing, merge it!

@@ -667,7 +665,7 @@ public boolean canImportDefinitons() {
return call.call();
} catch (final ConfigNotFoundException e) {
throw new IdNotFoundKnownException(String.format("Could not find configuration for %s: %s.", e.getType().toString(), e.getConfigId()),
e.getConfigId(), e);
e.getConfigId(), e);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is probably why the linting in the build is failing. 😉

Copy link
Contributor Author

@lmossman lmossman Oct 27, 2021

Choose a reason for hiding this comment

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

I think there is a small war happening between my intellij formatter and the gradle format command :p Still trying to get them a bit more in sync

@lmossman lmossman temporarily deployed to more-secrets October 27, 2021 22:09 Inactive
@lmossman lmossman temporarily deployed to more-secrets October 28, 2021 15:12 Inactive
@lmossman lmossman temporarily deployed to more-secrets October 28, 2021 18:46 Inactive
@lmossman lmossman force-pushed the lmossman/save-specs-to-db-on-create branch from 0157beb to 3796b65 Compare October 28, 2021 22:11
@lmossman lmossman temporarily deployed to more-secrets October 28, 2021 22:13 Inactive
@lmossman lmossman merged commit d525f1f into master Oct 28, 2021
@lmossman lmossman deleted the lmossman/save-specs-to-db-on-create branch October 28, 2021 23:00
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
…#7367)

* store spec in db

* update tests

* run gw format

* add TODOs

* add lmossman to TODOs

* run gw format

* remove redundant DockerImageValidator

* run gw format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/v1/(source/destination)_definitions/create should add the spec to the definition.
2 participants