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

Introduce webhook configs into workspace api and persistence #17950

Merged
merged 12 commits into from
Oct 14, 2022

Conversation

mfsiega-airbyte
Copy link
Contributor

@mfsiega-airbyte mfsiega-airbyte commented Oct 13, 2022

What

Introduce webhook configs into the workspace API and persistence layers.

How

  • Adds webhook config object as part of the workspace create/update/read routes.
  • Adds webhook config object to workspace persistence model.
  • Hooks up API to persistence layer.
  • Splits/hydrates secrets where applicable.

Recommended reading order

  1. airbyte-api/src/main/openapi/config.yaml
  2. airbyte-config/config-models/src/main/resources/types/WebhookOperationConfigs.yaml
  3. airbyte-config/config-models/src/main/resources/types/StandardWorkspace.yaml
  4. airbyte-server/src/main/java/io/airbyte/server/handlers/WorkspacesHandler.java
  5. Everything else

Testing

This has been manually tested locally. Adding automated tests is left as a TODO. The existing tests -- which do not exercise the webhook config handling -- should still pass.

@github-actions github-actions bot added area/api Related to the api area/documentation Improvements or additions to documentation area/platform issues related to the platform area/server labels Oct 13, 2022
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 16:53 Inactive
@mfsiega-airbyte mfsiega-airbyte changed the title Msiega/dbt cloud impl Introduce webhook configs into workspace api and persistence Oct 13, 2022
@mfsiega-airbyte mfsiega-airbyte marked this pull request as ready for review October 13, 2022 16:59
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 17:02 Inactive
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 18:08 Inactive
@@ -766,6 +766,8 @@ private void writeStandardWorkspace(final List<StandardWorkspace> configs, final
.set(WORKSPACE.FIRST_SYNC_COMPLETE, standardWorkspace.getFirstCompletedSync())
.set(WORKSPACE.FEEDBACK_COMPLETE, standardWorkspace.getFeedbackDone())
.set(WORKSPACE.UPDATED_AT, timestamp)
.set(WORKSPACE.WEBHOOK_OPERATION_CONFIGS, standardWorkspace.getWebhookOperationConfigs() == null ? null
Copy link
Contributor

Choose a reason for hiding this comment

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

note: we should make sure this is tested

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Planning on this being an e2e test (in a subsequent PR).

@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 19:17 Inactive
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 19:30 Inactive
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 19:40 Inactive
@davinchia davinchia temporarily deployed to more-secrets October 13, 2022 20:03 Inactive
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 22:00 Inactive
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 13, 2022 22:15 Inactive
.withWebhookOperationConfigs(Jsons.jsonNode(webhookConfigs));
secretsRepositoryWriter.writeWorkspace(workspace);
final var workspaceArgumentCaptor = ArgumentCaptor.forClass(StandardWorkspace.class);
verify(configRepository, times(1)).writeStandardWorkspaceNoSecrets(workspaceArgumentCaptor.capture());
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@@ -433,4 +444,37 @@ void testWriteDifferentStagingConfiguration() throws JsonValidationException, Co
Map.of(PASSWORD_FIELD_NAME, hmacSecretNewCoordinate.getFullCoordinate()))));
}

@Test
void testWriteWorkspaceSplitsSecrets() throws JsonValidationException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
void testWriteWorkspaceSplitsSecrets() throws JsonValidationException, IOException {
void testWriteWorkspaceSplitsAuthToken() throws JsonValidationException, IOException {

@@ -433,4 +444,37 @@ void testWriteDifferentStagingConfiguration() throws JsonValidationException, Co
Map.of(PASSWORD_FIELD_NAME, hmacSecretNewCoordinate.getFullCoordinate()))));
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

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

can also use the @DisplayName annotation to clarify this

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 call!

@@ -461,4 +466,42 @@ void testSetFeedbackDone() throws JsonValidationException, ConfigNotFoundExcepti
verify(configRepository).setFeedback(workspaceGiveFeedback.getWorkspaceId());
}

@Test
void testWorkspaceIsWrittenThroughSecretsWriter() throws JsonValidationException, ConfigNotFoundException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

the ConfigNotFoundException is not used

Copy link
Contributor

@davinchia davinchia 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!

Two minor comments and questions.

@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets October 14, 2022 00:14 Inactive
@mfsiega-airbyte mfsiega-airbyte merged commit 6a48da9 into master Oct 14, 2022
@mfsiega-airbyte mfsiega-airbyte deleted the msiega/dbt-cloud-impl branch October 14, 2022 00:59
letiescanciano added a commit that referenced this pull request Oct 14, 2022
…vation

* master: (98 commits)
  🐛 Source Bing Ads - Fix Campaigns stream misses Audience and Shopping (#17873)
  Source S3 - fix schema inference (#17991)
  🎉 JDBC sources: store cursor record count in db state (#15535)
  Introduce webhook configs into workspace api and persistence (#17950)
  ci: upload test results to github for analysis (#17953)
  Trigger the connectors build if there are worker changes. (#17976)
  Add additional sync timing information (#17643)
  Use page_token_option instead of page_token (#17892)
  capture metrics around json messages size (#17973)
  🐛 Correct kube annotations variable as per the docs. (#17972)
  🪟 🎉 Add /connector-builder page with embedded YAML editor (#17482)
  fix `est_num_metrics_emitted_by_reporter` not being emitted (#17929)
  Update schema dumps (#17960)
  Remove the bump in the value.yml (#17959)
  Ensure database initialization in test container (#17697)
  Remove typo line from incremental reads docs (#17920)
  DocS: Update authentication.md (#17931)
  Use MessageMigration for Source Connection Check. (#17656)
  fixed links (#17949)
  remove usages of YamlSeedConfigPersistence (#17895)
  ...
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
…hq#17950)

* wip

* handle webhook configs in workspaces endpoint and split/hydrate secrets

* style improvements to documentation around webhook configs

* Clarify documentation around webhook auth tokens

* More documentation clarification around webhook configs

* Format.

* unit test coverage for webhook config handling

* use common json parsing libraries around webhook configs

* clean up around testing webhook operation configs

Co-authored-by: Davin Chia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Related to the api area/documentation Improvements or additions to documentation area/platform issues related to the platform area/server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants