-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Conversation
airbyte-config/config-models/src/main/resources/types/WebhookOperationConfigs.yaml
Show resolved
Hide resolved
airbyte-config/config-models/src/main/resources/types/StandardWorkspace.yaml
Show resolved
Hide resolved
@@ -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 |
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.
note: we should make sure this is tested
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.
Planning on this being an e2e test (in a subsequent PR).
airbyte-server/src/main/java/io/airbyte/server/handlers/WorkspacesHandler.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/converters/WebhookOperationConfigsConverter.java
Outdated
Show resolved
Hide resolved
.../config-persistence/src/main/java/io/airbyte/config/persistence/SecretsRepositoryWriter.java
Outdated
Show resolved
Hide resolved
.withWebhookOperationConfigs(Jsons.jsonNode(webhookConfigs)); | ||
secretsRepositoryWriter.writeWorkspace(workspace); | ||
final var workspaceArgumentCaptor = ArgumentCaptor.forClass(StandardWorkspace.class); | ||
verify(configRepository, times(1)).writeStandardWorkspaceNoSecrets(workspaceArgumentCaptor.capture()); |
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.
nice!
@@ -433,4 +444,37 @@ void testWriteDifferentStagingConfiguration() throws JsonValidationException, Co | |||
Map.of(PASSWORD_FIELD_NAME, hmacSecretNewCoordinate.getFullCoordinate())))); | |||
} | |||
|
|||
@Test | |||
void testWriteWorkspaceSplitsSecrets() throws JsonValidationException, IOException { |
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.
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 |
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 also use the @DisplayName annotation to clarify this
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.
good call!
@@ -461,4 +466,42 @@ void testSetFeedbackDone() throws JsonValidationException, ConfigNotFoundExcepti | |||
verify(configRepository).setFeedback(workspaceGiveFeedback.getWorkspaceId()); | |||
} | |||
|
|||
@Test | |||
void testWorkspaceIsWrittenThroughSecretsWriter() throws JsonValidationException, ConfigNotFoundException, IOException { |
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 ConfigNotFoundException is not used
airbyte-server/src/test/java/io/airbyte/server/handlers/WorkspacesHandlerTest.java
Show resolved
Hide resolved
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.
Looks great!
Two minor comments and questions.
…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) ...
…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]>
What
Introduce webhook configs into the workspace API and persistence layers.
How
Recommended reading order
airbyte-api/src/main/openapi/config.yaml
airbyte-config/config-models/src/main/resources/types/WebhookOperationConfigs.yaml
airbyte-config/config-models/src/main/resources/types/StandardWorkspace.yaml
airbyte-server/src/main/java/io/airbyte/server/handlers/WorkspacesHandler.java
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.