Skip to content

Adds TLS check to mongodb destination and migrates util constants #18892

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

Merged
merged 5 commits into from
Nov 8, 2022

Conversation

ryankfu
Copy link
Contributor

@ryankfu ryankfu commented Nov 3, 2022

What

Closes #16279

How

Follows https://github.com/airbytehq/airbyte/pull/17590/files which adds the ability to check for Mongodb STANDALONE instances of MongoDB and reaffirm that the connection when tls flag is present is marked as true

Migrates some of the shared constants into an already pre-existing MongoUtils file

Recommended reading order

  1. MongodbDestinationStrictEncrypt.java
  2. MongoUtils.java
  3. MongodbDestinationStrictEncryptAcceptanceTest.java
  4. MongodbDestination.java

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

Yes, customers who have the tls flag disabled or set to false will experience breaking changes when running their check method. This is expected and within reason as the user should not be able to set their connection to insecure traffic within Airbyte Cloud

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/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

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
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as 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

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
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped 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

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

Affected Connector Report

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to do the following as needed:

  • Run integration tests
  • Bump connector version
  • Add changelog
  • Publish the new version

⚠ Sources (2)

Connector Version Changelog Publish
source-mongodb-strict-encrypt 0.1.19
(doc not found)

(not in seed)
source-mongodb-v2 0.1.19
  • See "Actionable Items" below for how to resolve warnings and errors.

⚠ Destinations (2)

Connector Version Changelog Publish
destination-mongodb 0.1.9
destination-mongodb-strict-encrypt 0.1.9
(not in seed)
  • See "Actionable Items" below for how to resolve warnings and errors.

Actionable Items

(click to expand)

Category Status Actionable Item
Version
mismatch
The version of the connector is different from its normal variant. Please bump the version of the connector.

doc not found
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug.
Changelog
doc not found
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug.

changelog missing
There is no chnagelog for the current version of the connector. If you are the author of the current version, please add a changelog.
Publish
not in seed
The connector is not in the seed file (e.g. source_definitions.yaml), so its publication status cannot be checked. This can be normal (e.g. some connectors are cloud-specific, and only listed in the cloud seed file). Please double-check to make sure that it is not a bug.

diff seed version
The connector exists in the seed file, but the latest version is not listed there. This usually means that the latest version is not published. Please use the /publish command to publish the latest version.

@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Nov 3, 2022
@ryankfu ryankfu requested review from tuliren, akashkulk and a team November 3, 2022 06:23
@ryankfu ryankfu marked this pull request as ready for review November 3, 2022 06:23
@ryankfu ryankfu requested a review from a team as a code owner November 3, 2022 06:23
import org.slf4j.LoggerFactory;

/**
* Currently this is a duplicate of the same file within destination-mongodb-strict-encrypt module.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tuliren just wanted to check, is there anything stopping me from moving the MongodbDestinationStrictEncrypt file from the destination-mongodb-strict-encrypt module instead of creating a copy of the MongodbDestinationStrictEncrypt in the non-strict-encrypt variant?

Currently hesitated to move the strict-encrypt variant since a duplicate file exists for the source-postgres and source-postgres-strict-encrypt

Copy link
Contributor

Choose a reason for hiding this comment

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

moving the MongodbDestinationStrictEncrypt file from the destination-mongodb-strict-encrypt module

After moving the strict encrypt class from the strict-encrypt module to the normal module, will the strict-encrypt module still have a mainClass in its build.gradle file? If yes, this would be the perfect solution for now. We won't have the duplicated class problem.

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 3, 2022

/test connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3383513055
❌ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3383513055
🐛 https://gradle.com/s/ahqrwtsgsdcwg

Build Failed

Test summary info:

Could not find result summary

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 3, 2022

/test connector=connectors/destination-s3-strict-encrypt

🕑 connectors/destination-s3-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3383513911
❌ connectors/destination-s3-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3383513911
🐛

Build Failed

Test summary info:

Could not find result summary

@ryankfu ryankfu requested review from suhomud and etsybaev and removed request for a team November 3, 2022 06:34
@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 3, 2022

/test connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3389538821
❌ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3389538821
🐛 https://gradle.com/s/wocydba5tcgs4

Build Failed

Test summary info:

Could not find result summary

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 4, 2022

/test connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3391207274
❌ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3391207274
🐛 https://gradle.com/s/jnzbocxmajx7a

Build Failed

Test summary info:

Could not find result summary

@ryankfu ryankfu force-pushed the ryan/desintation-mongodb-ssl branch from e6d3c64 to cc5ab7b Compare November 4, 2022 17:36
@github-actions github-actions bot removed area/frontend Related to the Airbyte webapp area/platform issues related to the platform labels Nov 4, 2022
@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 4, 2022

/test connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3395897008
✅ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3395897008
No Python unittests run

Build Passed

Test summary info:

All Passed

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 4, 2022

/test connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3396268161
❌ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3396268161
🐛 https://gradle.com/s/ty4fwapb3hida

Build Failed

Test summary info:

Could not find result summary

import com.fasterxml.jackson.databind.JsonNode;
import io.airbyte.db.jdbc.JdbcUtils;

public class MongoDbDestinationUtils {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a possibility of combining this with MongoDbSourceUtils to prevent code duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, initially I didn't do that simply because it was in different packages but looking at this right now I see there's a MongoUtils.java where these changes and your changes can live. I'll work on moving the changes over to that utility file

final MongoInstanceType instance = MongoInstanceType.fromValue(instanceConfig.get(MongoDbDestinationUtils.INSTANCE).asText());
// If the MongoDb destination connector is not set up to use a TLS connection, then check should fail
if (instance.equals(MongoInstanceType.STANDALONE) && !MongoDbDestinationUtils.tlsEnabledForStandaloneInstance(config, instanceConfig)) {
return new AirbyteConnectionStatus()
Copy link
Contributor

Choose a reason for hiding this comment

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

If this isn't urgent - can you hold off until I merge the PR that adds the config exception handling? That way - you can just throw a ConfigErrorException instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll probably rework the MongodbDestinationUtils and MongodbSourceUtils into MongoUtils.java in the meantime. Your changes for that PR config exception should be ready to merge unless there's something else you needed to follow up on

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, there's still a degree of integration test mangling that I need to do for that PR. To unblock you and others I have #18989 (which you already commented on)

I'll going to break that PR into smaller parts, but overall you should be unblocked on that front soon

Copy link
Contributor

Choose a reason for hiding this comment

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

That PR is merged, so you should be able to throw a ConfigErrorException here now

@ryankfu ryankfu force-pushed the ryan/desintation-mongodb-ssl branch from 94df360 to 2b1f9fe Compare November 7, 2022 22:51
@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 7, 2022

/test connector=connectors/source-mongodb-strict-encrypt

🕑 connectors/source-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3414737141
✅ connectors/source-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3414737141
No Python unittests run

Build Passed

Test summary info:

All Passed

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 7, 2022

/test connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3414738401
✅ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/3414738401
No Python unittests run

Build Passed

Test summary info:

All Passed

@ryankfu ryankfu temporarily deployed to more-secrets November 7, 2022 22:53 Inactive
@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 7, 2022

/test connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3414866055
❌ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3414866055
🐛 https://gradle.com/s/65hhxlnkkzthe

Build Failed

Test summary info:

Could not find result summary

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 8, 2022

/test connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3415160630
✅ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/3415160630
No Python unittests run

Build Passed

Test summary info:

All Passed

@ryankfu ryankfu temporarily deployed to more-secrets November 8, 2022 00:11 Inactive
@ryankfu ryankfu requested a review from akashkulk November 8, 2022 00:20
@ryankfu ryankfu requested review from akashkulk and removed request for tuliren November 8, 2022 18:18
@ryankfu ryankfu temporarily deployed to more-secrets November 8, 2022 18:27 Inactive
@ryankfu ryankfu temporarily deployed to more-secrets November 8, 2022 18:55 Inactive
@github-actions github-actions bot added area/documentation Improvements or additions to documentation area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Nov 8, 2022
@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 8, 2022

/publish connector=connectors/destination-mongodb run-tests=false

🕑 Publishing the following connectors:
connectors/destination-mongodb
https://github.com/airbytehq/airbyte/actions/runs/3422346979


Connector Did it publish? Were definitions generated?
connectors/destination-mongodb

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@ryankfu
Copy link
Contributor Author

ryankfu commented Nov 8, 2022

/publish connector=connectors/destination-mongodb-strict-encrypt run-tests=false auto-bump-version=false

🕑 Publishing the following connectors:
connectors/destination-mongodb-strict-encrypt
https://github.com/airbytehq/airbyte/actions/runs/3422347236


Connector Did it publish? Were definitions generated?
connectors/destination-mongodb-strict-encrypt

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets November 8, 2022 19:10 Inactive
@ryankfu ryankfu merged commit 804af5d into master Nov 8, 2022
@ryankfu ryankfu deleted the ryan/desintation-mongodb-ssl branch November 8, 2022 21:21
@grishick grishick added the team/destinations Destinations team's backlog label Nov 8, 2022
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
…8892)

* Adds TLS check to mongodb destination and migrates util constants

* Migrates MongodbSourceUitls to general purprose Utils file

* Updates expected_spec.json to include SSH tunnel

* Bumps connector version and removes connector from being hidden in UI

* auto-bump connector version

Co-authored-by: Octavia Squidington III <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to enforce SSL in MongoDB Destination connector
6 participants