From 7dd3c59953d0a30afea90b985f7c42fc27ae8cd0 Mon Sep 17 00:00:00 2001 From: bmunguli Date: Mon, 17 Jun 2024 09:43:54 +0200 Subject: [PATCH 01/12] chore: Initial repository setup --- .github/pull_request_template.md | 21 +++++++++++++++++++++ .github/workflows/pull_request_lint.yaml | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/pull_request_lint.yaml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..4d979924e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,21 @@ +## Description + + + +## Motivation + + + + +## Changes + + + +- Change 1 +- Change 2 +- Change 3 + +## Issue + +Refs: \ No newline at end of file diff --git a/.github/workflows/pull_request_lint.yaml b/.github/workflows/pull_request_lint.yaml new file mode 100644 index 000000000..0c0145137 --- /dev/null +++ b/.github/workflows/pull_request_lint.yaml @@ -0,0 +1,12 @@ +name: Lint +on: + pull_request: + branches: [main] + +jobs: + + pull_request_lint: + permissions: + pull-requests: write + name: PR Title + uses: Cofinity-X/central-pipelines/.github/workflows/_pull_request_lint.yaml@v1.2.0 From 049c46e5762116c7930d880a51a97c2588e823de Mon Sep 17 00:00:00 2001 From: Jaro Hartmann <57985712+ds-jhartmann@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:40:12 +0200 Subject: [PATCH 02/12] chore: [TRX-19] migrate upstream GitHub workflows and configs (#2) (cherry picked from commit 32beedaff3a4db9a5ad3e2d72904bb70472e54f1) --- .github/workflows/cucumber-integration-test-UMBRELLA.yaml | 2 +- .github/workflows/irs-build.yml | 4 ++++ .github/workflows/release.yaml | 2 +- .github/workflows/tavern-UMBRELLA.yml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cucumber-integration-test-UMBRELLA.yaml b/.github/workflows/cucumber-integration-test-UMBRELLA.yaml index ded32f7e3..d13a8093c 100644 --- a/.github/workflows/cucumber-integration-test-UMBRELLA.yaml +++ b/.github/workflows/cucumber-integration-test-UMBRELLA.yaml @@ -44,7 +44,7 @@ concurrency: jobs: execute-e2e-tests: - runs-on: tractusx-runner + runs-on: "${{ github.repository == 'eclipse-tractusx/item-relationship-service' && 'tractusx-runner' || 'ubuntu-latest' }}" steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/irs-build.yml b/.github/workflows/irs-build.yml index e04ffd449..a7c6131ed 100644 --- a/.github/workflows/irs-build.yml +++ b/.github/workflows/irs-build.yml @@ -165,6 +165,10 @@ jobs: trigger-trivy-image-scan: if: github.event_name != 'pull_request' + permissions: + actions: read + contents: read + security-events: write needs: - build_images uses: ./.github/workflows/trivy-docker-hub-scan.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d30f9597b..9da381260 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -73,7 +73,7 @@ jobs: # insert new comparison below uppermost one sed -i "$((latest_comparison_url_line_number+1)) s|^|[${{ inputs.irs-version }}]: \ - https://github.com/eclipse-tractusx/item-relationship-service/compare/$previous_irs_version...${{ inputs.irs-version }}\n|" ${{ env.CHANGELOG_PATH }} + ${{ github.server_url }}/${{ github.repository }}/compare/$previous_irs_version...${{ inputs.irs-version }}\n|" ${{ env.CHANGELOG_PATH }} # replace placeholder placeholder_line_number=$(cat -n ${{ env.CHANGELOG_PATH }} | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+") diff --git a/.github/workflows/tavern-UMBRELLA.yml b/.github/workflows/tavern-UMBRELLA.yml index 6b49c8595..48cf0d495 100644 --- a/.github/workflows/tavern-UMBRELLA.yml +++ b/.github/workflows/tavern-UMBRELLA.yml @@ -31,7 +31,7 @@ concurrency: jobs: test: - runs-on: tractusx-runner + runs-on: "${{ github.repository == 'eclipse-tractusx/item-relationship-service' && 'tractusx-runner' || 'ubuntu-latest' }}" steps: - uses: actions/checkout@v4 From af45bca08c918dbf6c9bc94cb31d3384b2888dea Mon Sep 17 00:00:00 2001 From: ds-jhartmann <57985712+ds-jhartmann@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:23:01 +0200 Subject: [PATCH 03/12] chore: [TRX-50] create docker image build workflow for cofinity image --- .github/workflows/cofinity-docker-image.yaml | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/cofinity-docker-image.yaml diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml new file mode 100644 index 000000000..39cc04848 --- /dev/null +++ b/.github/workflows/cofinity-docker-image.yaml @@ -0,0 +1,50 @@ +name: Docker image build Cofinity-X + +on: + workflow_dispatch: # Trigger manually + pull_request: + paths-ignore: + - '**/*.md' + - '**/*.txt' + - 'charts/**' + - '.config/**' + - 'docs/**' + - '!docs/src/api/**' + - 'local/**' + - 'CHANGELOG.md' + + push: + branches: + - main + tags: + - '**' + +jobs: + push-image-to-registry: + permissions: + contents: read + actions: read + security-events: write + id-token: write + name: Central Pipelines (Docker) + uses: Cofinity-X/central-pipelines/.github/workflows/reusable-publish-image-to-acr.yaml@main + with: + team_name: "trace-x" + repository_name: "item-relationship-service" + service_name: "irs-api" + dockerfile_path: "./Dockerfile" + environment: "int" + push: false + secrets: + AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} + AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + trivy-latest-image-scan: + permissions: + actions: read + security-events: write + name: Scan latest image + uses: Cofinity-X/central-pipelines/.github/workflows/reusable-trivy-acr-latest-image-scan.yaml@main + + From 77f0d8bd014321adc7dc47310dc897b0a68dfff0 Mon Sep 17 00:00:00 2001 From: ds-jhartmann <57985712+ds-jhartmann@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:47:18 +0200 Subject: [PATCH 04/12] chore: [TRX-50] remove trivy scan --- .github/workflows/cofinity-docker-image.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml index 39cc04848..026ed44f4 100644 --- a/.github/workflows/cofinity-docker-image.yaml +++ b/.github/workflows/cofinity-docker-image.yaml @@ -39,12 +39,3 @@ jobs: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - trivy-latest-image-scan: - permissions: - actions: read - security-events: write - name: Scan latest image - uses: Cofinity-X/central-pipelines/.github/workflows/reusable-trivy-acr-latest-image-scan.yaml@main - - From 8afe72e08d8f0725624ad675ff2119074e24e876 Mon Sep 17 00:00:00 2001 From: ds-jhartmann <57985712+ds-jhartmann@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:27:05 +0200 Subject: [PATCH 05/12] chore: [TRX-50] add concurrency restriction --- .github/workflows/cofinity-docker-image.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml index 026ed44f4..79a954bcf 100644 --- a/.github/workflows/cofinity-docker-image.yaml +++ b/.github/workflows/cofinity-docker-image.yaml @@ -19,6 +19,11 @@ on: tags: - '**' +concurrency: + # cancel older running jobs on the same branch + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: push-image-to-registry: permissions: @@ -33,8 +38,8 @@ jobs: repository_name: "item-relationship-service" service_name: "irs-api" dockerfile_path: "./Dockerfile" - environment: "int" - push: false + environment: "test" + push: true secrets: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} From 09e3c625b1308e24647b7a8e797e97fcd9659dbb Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 11 Sep 2024 16:49:42 +0200 Subject: [PATCH 06/12] chore: [TRX-50] add correct env to publish image pipeline --- .github/workflows/cofinity-docker-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml index 79a954bcf..7393041ca 100644 --- a/.github/workflows/cofinity-docker-image.yaml +++ b/.github/workflows/cofinity-docker-image.yaml @@ -38,7 +38,7 @@ jobs: repository_name: "item-relationship-service" service_name: "irs-api" dockerfile_path: "./Dockerfile" - environment: "test" + environment: "lower-env-acr" push: true secrets: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} From 9b361cc6bbdb980c9d26da6355d18530d89e4a39 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener <124587888+ds-mwesener@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:10:33 +0200 Subject: [PATCH 07/12] chore: [TRX-50] add auto dispatcher for irs-a and irs-b trace-x charts. (#10) --- .github/workflows/cofinity-docker-image.yaml | 68 ++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml index 7393041ca..9cdfa48f6 100644 --- a/.github/workflows/cofinity-docker-image.yaml +++ b/.github/workflows/cofinity-docker-image.yaml @@ -44,3 +44,71 @@ jobs: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + auto-deploy-dispatch: + needs: push-image-to-registry + name: Dispatch charts repo workflow + runs-on: ubuntu-latest + if: ${{ (github.event_name != 'pull_request') && (github.ref_type != 'tag') }} # Execute only if container image is pushed and no tag is published + steps: + # Get image tags from the previous job filter the tag that needs to be updated (Currently, it's main-{sha}) + - name: Get image tags + id: get_tag + run: | + for image_tag in $(echo "${{ needs.dockerizing-application.outputs.image_tags }}") + do + tag=$(echo $image_tag | cut -d ":" -f2) + if [[ $tag == main* ]]; + then + main_tag=$tag + fi + done + echo "main_tag=$main_tag" >> $GITHUB_OUTPUT + + # Generate a temporary token using Github app + - name: Get token + id: get_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CORE_SERVICES_WORKFLOW_TRIGGER_GH_APP_ID }} + private-key: ${{ secrets.CORE_SERVICES_WORKFLOW_TRIGGER_GH_APP_PRIVATE_KEY }} + repositories: trace-x-charts + owner: cofinity-x + + # Trigger remote workflow of trace-x-chart to update the image tag in the helm values + - name: Trigger workflow for trace-x-a (irs) + id: trigger_remote_workflow-trace-x-a + env: + TOKEN: ${{ steps.get_token.outputs.token }} + HELM_VALUES_PATH: "item-relationship-service/dev/values-dev-a.yaml" + IMAGE_TAG: ${{ steps.get_tag.outputs.main_tag }} + IMAGE_TAG_PROPERTY: '(.[\"service\", \"migrations\"].image.tag)' + GITHUB_RUN_ID: ${{ github.run_id }} + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/cofinity-x/trace-x-charts/dispatches \ + -d '{"event_type":"update_dev_image_tag","client_payload": { "image_tag": "'"$IMAGE_TAG"'", "helm_values_path": "'"$HELM_VALUES_PATH"'", "image_tag_property": "'"$IMAGE_TAG_PROPERTY"'", "dispatcher_info": "'"Runner id - $GITHUB_RUN_ID"'" }}' \ + --fail + + # Trigger remote workflow of core-services-chart to update the image tag in the helm values + - name: Trigger workflow for trace-x-b (irs) + id: trigger_remote_workflow-trace-x-b + env: + TOKEN: ${{ steps.get_token.outputs.token }} + HELM_VALUES_PATH: "item-relationship-service/dev/values-dev-b.yaml" + IMAGE_TAG: ${{ steps.get_tag.outputs.main_tag }} + IMAGE_TAG_PROPERTY: '(.[\"service\", \"migrations\"].image.tag)' + GITHUB_RUN_ID: ${{ github.run_id }} + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/cofinity-x/trace-x-charts/dispatches \ + -d '{"event_type":"update_dev_image_tag","client_payload": { "image_tag": "'"$IMAGE_TAG"'", "helm_values_path": "'"$HELM_VALUES_PATH"'", "image_tag_property": "'"$IMAGE_TAG_PROPERTY"'", "dispatcher_info": "'"Runner id - $GITHUB_RUN_ID"'" }}' \ + --fail From d781c18b421b6fcd46cd54d2d2355ec9906ba64f Mon Sep 17 00:00:00 2001 From: avishekpathania Date: Mon, 23 Sep 2024 13:03:51 +0200 Subject: [PATCH 08/12] chore : [TRX-96] Adapt-Discovery-flow (bpnl) --- .../configmap-spring-app-config.yaml | 1 + charts/item-relationship-service/values.yaml | 1 + .../configuration/RegistryConfiguration.java | 6 +++-- .../registryclient/DefaultConfiguration.java | 5 +++-- .../discovery/ConnectorEndpointsService.java | 3 ++- .../DefaultConfigurationTest.java | 2 +- ...igitalTwinRegistryServiceWiremockTest.java | 2 +- .../ConnectorEndpointsServiceTest.java | 2 +- .../DiscoveryFinderClientImplTest.java | 2 +- .../discovery/templates/configmap.yaml | 22 +++++++++---------- .../discovery/templates/deployment.yaml | 3 +++ 11 files changed, 29 insertions(+), 20 deletions(-) diff --git a/charts/item-relationship-service/templates/configmap-spring-app-config.yaml b/charts/item-relationship-service/templates/configmap-spring-app-config.yaml index aefab9cf4..7149cdc67 100644 --- a/charts/item-relationship-service/templates/configmap-spring-app-config.yaml +++ b/charts/item-relationship-service/templates/configmap-spring-app-config.yaml @@ -80,6 +80,7 @@ data: discovery: oAuthClientId: {{ .Values.discovery.oAuthClientId | default "discovery" }} # ID of the OAuth2 client registration to use, see config spring.security.oauth2.client discoveryFinderUrl: {{ tpl (.Values.discovery.discoveryFinderUrl | default "") . | quote }} # The endpoint to discover EDC endpoints to a particular BPN. + type: {{ .Values.discovery.type | default "bpnl" }} # Type to discover EDC of type "bpnl". semanticshub: url: {{ tpl (.Values.semanticshub.url | default "") . | quote }} diff --git a/charts/item-relationship-service/values.yaml b/charts/item-relationship-service/values.yaml index fa818ec8f..654d00988 100644 --- a/charts/item-relationship-service/values.yaml +++ b/charts/item-relationship-service/values.yaml @@ -132,6 +132,7 @@ digitalTwinRegistry: discovery: oAuthClientId: discovery # ID of the OAuth2 client registration to use, see config spring.security.oauth2.client discoveryFinderUrl: # "https:// + type: "bpnl" semanticshub: url: # https:// diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/configuration/RegistryConfiguration.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/configuration/RegistryConfiguration.java index ec10c41d4..b8cdd0bb4 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/configuration/RegistryConfiguration.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/configuration/RegistryConfiguration.java @@ -97,10 +97,12 @@ public DecentralDigitalTwinRegistryService decentralDigitalTwinRegistryService( @Bean public ConnectorEndpointsService connectorEndpointsService( @Qualifier(RestTemplateConfig.DTR_REST_TEMPLATE) final RestTemplate dtrRestTemplate, - @Value("${digitalTwinRegistry.discovery.discoveryFinderUrl:}") final String finderUrl) { - return new ConnectorEndpointsService(discoveryFinderClient(dtrRestTemplate, finderUrl)); + @Value("${digitalTwinRegistry.discovery.discoveryFinderUrl:}") final String finderUrl, + @Value("${digitalTwinRegistry.discovery.type:}") final String discoveryType) { + return new ConnectorEndpointsService(discoveryFinderClient(dtrRestTemplate, finderUrl), discoveryType); } + @Bean public DiscoveryFinderClient discoveryFinderClient( @Qualifier(RestTemplateConfig.DTR_REST_TEMPLATE) final RestTemplate dtrRestTemplate, diff --git a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/DefaultConfiguration.java b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/DefaultConfiguration.java index 230c66d7e..c87b8a795 100644 --- a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/DefaultConfiguration.java +++ b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/DefaultConfiguration.java @@ -110,8 +110,9 @@ public DiscoveryFinderClient discoveryFinderClient( @Bean @ConditionalOnProperty(prefix = CONFIG_PREFIX, name = CONFIG_FIELD_TYPE, havingValue = CONFIG_VALUE_DECENTRAL) - public ConnectorEndpointsService connectorEndpointsService(final DiscoveryFinderClient discoveryFinderClient) { - return new ConnectorEndpointsService(discoveryFinderClient); + public ConnectorEndpointsService connectorEndpointsService(final DiscoveryFinderClient discoveryFinderClient, + @Value("${digitalTwinRegistryClient.discovery.type:}") final String discoveryType) { + return new ConnectorEndpointsService(discoveryFinderClient, discoveryType); } @Bean diff --git a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsService.java b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsService.java index a5333b659..43bb738fb 100644 --- a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsService.java +++ b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsService.java @@ -43,6 +43,7 @@ public class ConnectorEndpointsService { private final DiscoveryFinderClient discoveryFinderClient; private static final String CONNECTOR_ENDPOINT_SERVICE_CACHE_NAME = "connector_endpoint_service_cache"; + private final String discoveryType; /** * Get EDCs for BPN. @@ -60,7 +61,7 @@ public List fetchConnectorEndpoints(final String bpn) { log.info("Requesting connector endpoints for BPN {}", bpn); - final var onlyBpn = new DiscoveryFinderRequest(List.of("bpn")); + final var onlyBpn = new DiscoveryFinderRequest(List.of(discoveryType)); final var discoveryEndpoints = discoveryFinderClient.findDiscoveryEndpoints(onlyBpn).endpoints(); final var endpoints = discoveryEndpoints.stream() .flatMap( diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java index 22bbf0c67..534db2973 100644 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java +++ b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java @@ -64,7 +64,7 @@ void centralDigitalTwinRegistryService() { void decentralDigitalTwinRegistryService() { final EdcSubmodelFacade facadeMock = mock(EdcSubmodelFacade.class); final var service = testee.decentralDigitalTwinRegistryService( - testee.connectorEndpointsService(testee.discoveryFinderClient(new RestTemplate(), "finder")), + testee.connectorEndpointsService(testee.discoveryFinderClient(new RestTemplate(), "finder"),"bpnl"), testee.endpointDataForConnectorsService(facadeMock), testee.decentralDigitalTwinRegistryClient(new RestTemplate(), descriptorTemplate, shellLookupTemplate), edcConfiguration); diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceWiremockTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceWiremockTest.java index f34da4215..522686ed1 100644 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceWiremockTest.java +++ b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceWiremockTest.java @@ -93,7 +93,7 @@ void setUp(WireMockRuntimeInfo wireMockRuntimeInfo) { final RestTemplate restTemplate = restTemplateProxy(PROXY_SERVER_HOST, wireMockRuntimeInfo.getHttpPort()); final var discoveryFinderClient = new DiscoveryFinderClientImpl(DISCOVERY_FINDER_URL, restTemplate); - final var connectorEndpointsService = new ConnectorEndpointsService(discoveryFinderClient); + final var connectorEndpointsService = new ConnectorEndpointsService(discoveryFinderClient, "bpnl"); final var endpointDataForConnectorsService = new EndpointDataForConnectorsService( edcEndpointReferenceRetrieverMock); final var decentralDigitalTwinRegistryClient = new DecentralDigitalTwinRegistryClient(restTemplate, diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsServiceTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsServiceTest.java index 5511c078c..d7b5dc693 100644 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsServiceTest.java +++ b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/ConnectorEndpointsServiceTest.java @@ -36,7 +36,7 @@ class ConnectorEndpointsServiceTest { private final DiscoveryFinderClient essDiscoveryFinderClient = Mockito.mock(DiscoveryFinderClient.class); - private final ConnectorEndpointsService service = new ConnectorEndpointsService(essDiscoveryFinderClient); + private final ConnectorEndpointsService service = new ConnectorEndpointsService(essDiscoveryFinderClient, "bpnl" ); @Test void shouldFindConnectorEndpoints() { diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/DiscoveryFinderClientImplTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/DiscoveryFinderClientImplTest.java index 9a14c6df3..0786df7d7 100644 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/DiscoveryFinderClientImplTest.java +++ b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/discovery/DiscoveryFinderClientImplTest.java @@ -61,7 +61,7 @@ void findDiscoveryEndpoints_shouldReturnResponseFromRestRequest() { final DiscoveryResponse mockResponse = new DiscoveryResponse( List.of(new DiscoveryEndpoint("test-endpoint", "desc", "test-endpoint-addr", "docs", "resId"))); - final var request = new DiscoveryFinderRequest(List.of("bpn")); + final var request = new DiscoveryFinderRequest(List.of("bpnl")); when(restTemplate.postForObject(DISCOVERY_FINDER_URL, request, DiscoveryResponse.class)).thenReturn( mockResponse); diff --git a/local/deployment/full-irs/subcharts/discovery/templates/configmap.yaml b/local/deployment/full-irs/subcharts/discovery/templates/configmap.yaml index 18c1492ee..023dac9bc 100644 --- a/local/deployment/full-irs/subcharts/discovery/templates/configmap.yaml +++ b/local/deployment/full-irs/subcharts/discovery/templates/configmap.yaml @@ -101,16 +101,16 @@ data: bpn_discovery_service_response.json: |- { "bpns": [ - {"type": "bpn","key": ".*","value": "BPNL00000000BJTL","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003AVTH","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003AXS3","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003AYRE","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003AZQP","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003B0Q0","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003B2OM","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003B3NX","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, - {"type": "bpn","key": ".*","value": "BPNL00000003CSGV","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"} + {"type": "bpnl","key": ".*","value": "BPNL00000000BJTL","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003AVTH","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003AXS3","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003AYRE","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003AZQP","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003B0Q0","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003B2OM","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003B3NX","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}, + {"type": "bpnl","key": ".*","value": "BPNL00000003CSGV","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"} ] } diff --git a/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml b/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml index d6a4b0381..b8784f88a 100644 --- a/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml +++ b/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml @@ -61,6 +61,9 @@ spec: - name: http containerPort: {{ .Values.service.port }} protocol: TCP + env: + - name: DISCOVERY_TYPE + value: { { .Values.discovery.type | quote } } livenessProbe: httpGet: path: /__admin From f781e29285151990837734bc3ff57c7c34315530 Mon Sep 17 00:00:00 2001 From: avishekpathania Date: Mon, 23 Sep 2024 14:47:26 +0200 Subject: [PATCH 09/12] [TRX-96]: fixed small changes in values.yaml, deployment.yaml, DefaultConfigurationTest --- charts/item-relationship-service/values.yaml | 2 +- .../tractusx/irs/registryclient/DefaultConfigurationTest.java | 2 +- .../full-irs/subcharts/discovery/templates/deployment.yaml | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/charts/item-relationship-service/values.yaml b/charts/item-relationship-service/values.yaml index 654d00988..2a5116b1f 100644 --- a/charts/item-relationship-service/values.yaml +++ b/charts/item-relationship-service/values.yaml @@ -132,7 +132,7 @@ digitalTwinRegistry: discovery: oAuthClientId: discovery # ID of the OAuth2 client registration to use, see config spring.security.oauth2.client discoveryFinderUrl: # "https:// - type: "bpnl" + type: "bpnl" # discovery type to find bpnl type in EDC discovery semanticshub: url: # https:// diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java index 534db2973..33872ec49 100644 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java +++ b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/DefaultConfigurationTest.java @@ -64,7 +64,7 @@ void centralDigitalTwinRegistryService() { void decentralDigitalTwinRegistryService() { final EdcSubmodelFacade facadeMock = mock(EdcSubmodelFacade.class); final var service = testee.decentralDigitalTwinRegistryService( - testee.connectorEndpointsService(testee.discoveryFinderClient(new RestTemplate(), "finder"),"bpnl"), + testee.connectorEndpointsService(testee.discoveryFinderClient(new RestTemplate(), "finder"), "bpnl"), testee.endpointDataForConnectorsService(facadeMock), testee.decentralDigitalTwinRegistryClient(new RestTemplate(), descriptorTemplate, shellLookupTemplate), edcConfiguration); diff --git a/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml b/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml index b8784f88a..d6a4b0381 100644 --- a/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml +++ b/local/deployment/full-irs/subcharts/discovery/templates/deployment.yaml @@ -61,9 +61,6 @@ spec: - name: http containerPort: {{ .Values.service.port }} protocol: TCP - env: - - name: DISCOVERY_TYPE - value: { { .Values.discovery.type | quote } } livenessProbe: httpGet: path: /__admin From 70ba967e856da57c9bdfc04c5c594321a805f91d Mon Sep 17 00:00:00 2001 From: Maximilian Wesener <124587888+ds-mwesener@users.noreply.github.com> Date: Tue, 24 Sep 2024 08:08:49 +0200 Subject: [PATCH 10/12] chore: Fix image tag overrides of dispatch (#13) --- .github/workflows/cofinity-docker-image.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml index 9cdfa48f6..50d326e80 100644 --- a/.github/workflows/cofinity-docker-image.yaml +++ b/.github/workflows/cofinity-docker-image.yaml @@ -70,8 +70,8 @@ jobs: id: get_token uses: actions/create-github-app-token@v1 with: - app-id: ${{ secrets.CORE_SERVICES_WORKFLOW_TRIGGER_GH_APP_ID }} - private-key: ${{ secrets.CORE_SERVICES_WORKFLOW_TRIGGER_GH_APP_PRIVATE_KEY }} + app-id: ${{ secrets.TRACE_X_WORKFLOW_TRIGGER_GH_APP_ID }} + private-key: ${{ secrets.TRACE_X_WORKFLOW_TRIGGER_GH_APP_PRIVATE_KEY }} repositories: trace-x-charts owner: cofinity-x @@ -82,7 +82,7 @@ jobs: TOKEN: ${{ steps.get_token.outputs.token }} HELM_VALUES_PATH: "item-relationship-service/dev/values-dev-a.yaml" IMAGE_TAG: ${{ steps.get_tag.outputs.main_tag }} - IMAGE_TAG_PROPERTY: '(.[\"service\", \"migrations\"].image.tag)' + IMAGE_TAG_PROPERTY: 'image.tag' GITHUB_RUN_ID: ${{ github.run_id }} run: | curl -L \ @@ -101,7 +101,7 @@ jobs: TOKEN: ${{ steps.get_token.outputs.token }} HELM_VALUES_PATH: "item-relationship-service/dev/values-dev-b.yaml" IMAGE_TAG: ${{ steps.get_tag.outputs.main_tag }} - IMAGE_TAG_PROPERTY: '(.[\"service\", \"migrations\"].image.tag)' + IMAGE_TAG_PROPERTY: 'image.tag' GITHUB_RUN_ID: ${{ github.run_id }} run: | curl -L \ From d87218de282a3c0455bc8a677f8ceb57d50ec595 Mon Sep 17 00:00:00 2001 From: "Avishek Pathania (Cofinity-X)" Date: Tue, 24 Sep 2024 16:50:08 +0200 Subject: [PATCH 11/12] [TRX-96]: updated the chnageLogs --- CHANGELOG.md | 4 ++++ charts/item-relationship-service/CHANGELOG.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43edbf9d0..596a50569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ _**For better traceability add the corresponding GitHub issue number in each cha ## [Unreleased] +### Changed + +- Added the discovery type configurable, with a default value of bpnl in (ConnectorEndpointsService) (#12) + ## [5.4.1] - 2024-08-19 ### Fixed diff --git a/charts/item-relationship-service/CHANGELOG.md b/charts/item-relationship-service/CHANGELOG.md index 5ce205eff..50c869611 100644 --- a/charts/item-relationship-service/CHANGELOG.md +++ b/charts/item-relationship-service/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Added the discovery type configurable (discovery.type) default value as bpnl. (#12). + ## [7.4.1] - 2024-08-19 ### Changed From 5e8c9b1f90b0dfa7fe6908b43b662385fab66dcd Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 2 Oct 2024 15:40:43 +0200 Subject: [PATCH 12/12] chore: [TRX-XX] revert for upstream sync --- .github/pull_request_template.md | 21 ---- .github/workflows/cofinity-docker-image.yaml | 114 ------------------- .github/workflows/pull_request_lint.yaml | 12 -- 3 files changed, 147 deletions(-) delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/cofinity-docker-image.yaml delete mode 100644 .github/workflows/pull_request_lint.yaml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 4d979924e..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -## Description - - - -## Motivation - - - - -## Changes - - - -- Change 1 -- Change 2 -- Change 3 - -## Issue - -Refs: \ No newline at end of file diff --git a/.github/workflows/cofinity-docker-image.yaml b/.github/workflows/cofinity-docker-image.yaml deleted file mode 100644 index 50d326e80..000000000 --- a/.github/workflows/cofinity-docker-image.yaml +++ /dev/null @@ -1,114 +0,0 @@ -name: Docker image build Cofinity-X - -on: - workflow_dispatch: # Trigger manually - pull_request: - paths-ignore: - - '**/*.md' - - '**/*.txt' - - 'charts/**' - - '.config/**' - - 'docs/**' - - '!docs/src/api/**' - - 'local/**' - - 'CHANGELOG.md' - - push: - branches: - - main - tags: - - '**' - -concurrency: - # cancel older running jobs on the same branch - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - push-image-to-registry: - permissions: - contents: read - actions: read - security-events: write - id-token: write - name: Central Pipelines (Docker) - uses: Cofinity-X/central-pipelines/.github/workflows/reusable-publish-image-to-acr.yaml@main - with: - team_name: "trace-x" - repository_name: "item-relationship-service" - service_name: "irs-api" - dockerfile_path: "./Dockerfile" - environment: "lower-env-acr" - push: true - secrets: - AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - auto-deploy-dispatch: - needs: push-image-to-registry - name: Dispatch charts repo workflow - runs-on: ubuntu-latest - if: ${{ (github.event_name != 'pull_request') && (github.ref_type != 'tag') }} # Execute only if container image is pushed and no tag is published - steps: - # Get image tags from the previous job filter the tag that needs to be updated (Currently, it's main-{sha}) - - name: Get image tags - id: get_tag - run: | - for image_tag in $(echo "${{ needs.dockerizing-application.outputs.image_tags }}") - do - tag=$(echo $image_tag | cut -d ":" -f2) - if [[ $tag == main* ]]; - then - main_tag=$tag - fi - done - echo "main_tag=$main_tag" >> $GITHUB_OUTPUT - - # Generate a temporary token using Github app - - name: Get token - id: get_token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.TRACE_X_WORKFLOW_TRIGGER_GH_APP_ID }} - private-key: ${{ secrets.TRACE_X_WORKFLOW_TRIGGER_GH_APP_PRIVATE_KEY }} - repositories: trace-x-charts - owner: cofinity-x - - # Trigger remote workflow of trace-x-chart to update the image tag in the helm values - - name: Trigger workflow for trace-x-a (irs) - id: trigger_remote_workflow-trace-x-a - env: - TOKEN: ${{ steps.get_token.outputs.token }} - HELM_VALUES_PATH: "item-relationship-service/dev/values-dev-a.yaml" - IMAGE_TAG: ${{ steps.get_tag.outputs.main_tag }} - IMAGE_TAG_PROPERTY: 'image.tag' - GITHUB_RUN_ID: ${{ github.run_id }} - run: | - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $TOKEN" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/cofinity-x/trace-x-charts/dispatches \ - -d '{"event_type":"update_dev_image_tag","client_payload": { "image_tag": "'"$IMAGE_TAG"'", "helm_values_path": "'"$HELM_VALUES_PATH"'", "image_tag_property": "'"$IMAGE_TAG_PROPERTY"'", "dispatcher_info": "'"Runner id - $GITHUB_RUN_ID"'" }}' \ - --fail - - # Trigger remote workflow of core-services-chart to update the image tag in the helm values - - name: Trigger workflow for trace-x-b (irs) - id: trigger_remote_workflow-trace-x-b - env: - TOKEN: ${{ steps.get_token.outputs.token }} - HELM_VALUES_PATH: "item-relationship-service/dev/values-dev-b.yaml" - IMAGE_TAG: ${{ steps.get_tag.outputs.main_tag }} - IMAGE_TAG_PROPERTY: 'image.tag' - GITHUB_RUN_ID: ${{ github.run_id }} - run: | - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $TOKEN" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/cofinity-x/trace-x-charts/dispatches \ - -d '{"event_type":"update_dev_image_tag","client_payload": { "image_tag": "'"$IMAGE_TAG"'", "helm_values_path": "'"$HELM_VALUES_PATH"'", "image_tag_property": "'"$IMAGE_TAG_PROPERTY"'", "dispatcher_info": "'"Runner id - $GITHUB_RUN_ID"'" }}' \ - --fail diff --git a/.github/workflows/pull_request_lint.yaml b/.github/workflows/pull_request_lint.yaml deleted file mode 100644 index 0c0145137..000000000 --- a/.github/workflows/pull_request_lint.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: Lint -on: - pull_request: - branches: [main] - -jobs: - - pull_request_lint: - permissions: - pull-requests: write - name: PR Title - uses: Cofinity-X/central-pipelines/.github/workflows/_pull_request_lint.yaml@v1.2.0