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

Avoid autosetup failure on connector test failed #58

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public Map<String, String> verifyConnectorTestingThroughTestService(Customer cus
.apiKeyHeader(inputData.get("edcApiKey")).apiKeyValue(inputData.get("edcApiKeyValue"))
.connectorHost(inputData.get("controlPlaneEndpoint")).build();

inputData.put("testServiceURL", connectorTestServiceURL);

waitingTime();

ConnectorTestServiceResponse testResult = connectorTestServiceProxy
Expand All @@ -55,12 +57,12 @@ public Map<String, String> verifyConnectorTestingThroughTestService(Customer cus

inputData.put("connectorTestResult", testResult.getMessage());

inputData.put("testServiceURL", connectorTestServiceURL);

autoSetupTriggerDetails.setStatus(TriggerStatusEnum.SUCCESS.name());

} catch (Exception ex) {

inputData.put("connectorTestResult", "The automatic test wasn't successfully completed");

log.error("ConnectorTestService failed retry attempt: : {}",
RetrySynchronizationManager.getContext().getRetryCount() + 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import org.eclipse.tractusx.autosetup.constant.AppActions;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerEntry;
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.manager.AppDeleteManager;
import org.eclipse.tractusx.autosetup.manager.CertificateManager;
import org.eclipse.tractusx.autosetup.manager.ConnectorRegistrationManager;
Expand All @@ -43,9 +44,11 @@
import org.springframework.stereotype.Component;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Component
@RequiredArgsConstructor
@Slf4j
public class EDCConnectorWorkFlow {

private final CertificateManager certificateManager;
Expand All @@ -72,8 +75,12 @@ public Map<String, String> getWorkFlow(Customer customerDetails, SelectedTools t
inputConfiguration.putAll(
connectorRegistrationManager.registerConnector(customerDetails, tool, inputConfiguration, triger));

inputConfiguration.putAll(testConnectorServiceManager.verifyConnectorTestingThroughTestService(customerDetails,
inputConfiguration, triger));
try {
inputConfiguration.putAll(testConnectorServiceManager
.verifyConnectorTestingThroughTestService(customerDetails, inputConfiguration, triger));
} catch (ServiceException ex) {
log.warn(ex.getMessage());
}

return inputConfiguration;
}
Expand All @@ -99,9 +106,13 @@ public Map<String, String> getWorkFlowSeparateCPandDP(Customer customerDetails,
edcDataplaneManager.managePackage(customerDetails, workflowAction, tool, inputConfiguration, triger));
inputConfiguration.putAll(
connectorRegistrationManager.registerConnector(customerDetails, tool, inputConfiguration, triger));

inputConfiguration.putAll(testConnectorServiceManager.verifyConnectorTestingThroughTestService(customerDetails,
inputConfiguration, triger));

try {
inputConfiguration.putAll(testConnectorServiceManager
.verifyConnectorTestingThroughTestService(customerDetails, inputConfiguration, triger));
} catch (ServiceException ex) {
log.warn(ex.getMessage());
}

return inputConfiguration;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/flyway/V1__auto-setup-table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ connector.discovery.token-url=$\{sde.connector.discovery.token-url\}

connector.discovery.clientId=$\{sde.connector.discovery.clientId\}

connector.discovery.clientSecret=$\{sde.connector.discovery.clientSecret\}', NULL, 'sde-backend/dftbackend', '1.9.0', 'helm.packages', 'v1alpha1', '{"dftpostgresql": {"enabled": true, "auth" : {"secretKeys":{"password":"$\{postgresPassword}"\},"username":"$\{username\}","database":"$\{database\}"}},"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftbackend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
connector.discovery.clientSecret=$\{sde.connector.discovery.clientSecret\}', NULL, 'sde-backend/dftbackend', '2.0.0', 'helm.packages', 'v1alpha1', '{"dftpostgresql": {"enabled": true, "primary":{"persistence":{"size" :"1Gi"}},"persistence":{"size" :"1Gi"}, "auth" : {"secretKeys":{"password":"$\{postgresPassword}"\},"username":"$\{username\}","database":"$\{database\}"}},"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftbackend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('DFT_FRONTEND', 'default', 'kubeapps', 'REACT_APP_API_URL=$\{dftBackEndUrl\}
Expand All @@ -125,7 +125,7 @@ REACT_APP_CLIENT_ID=$\{dftfrontendkeycloakclientid\}

REACT_APP_DEFAULT_COMPANY_BPN=$\{bpnNumber\}

REACT_APP_FILESIZE=268435456', NULL, 'sde-frontend/dftfrontend', '1.9.0', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftfrontend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
REACT_APP_FILESIZE=268435456', NULL, 'sde-frontend/dftfrontend', '2.0.0', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftfrontend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('EDC_CONTROLPLANE', 'default', 'kubeapps', 'edc.receiver.http.endpoint=$\{dftAddress\}
Expand Down