From e247f9f26ef0e030f14cb86438edc78479baf104 Mon Sep 17 00:00:00 2001 From: Stefan Obermeier Date: Wed, 1 Nov 2023 22:10:55 +0100 Subject: [PATCH 01/27] Fix typo in README.md --- charts/semantic-hub/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/semantic-hub/README.md b/charts/semantic-hub/README.md index 00d37f50..40e4a1b7 100644 --- a/charts/semantic-hub/README.md +++ b/charts/semantic-hub/README.md @@ -19,7 +19,7 @@ This Helm charts installs the Semantic Hub application and its dependencies. ## Install ``` kubectl create namespace semantics -helm install hub -n semantics ./charts/semantic-hub` +helm install hub -n semantics ./charts/semantic-hub ``` ## Values From 1a9cf2f9762105404806ce90fc4095366feb9a29 Mon Sep 17 00:00:00 2001 From: Sebastian Scherer <59142915+scherersebastian@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:30:59 +0100 Subject: [PATCH 02/27] docs: add data flow diagram --- docs/documentation.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/documentation.md b/docs/documentation.md index 9e2827e7..3de2da05 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -79,6 +79,29 @@ FILTER ( $param == ?o ) // Custom filter can be added here. ?s ?p ?o . } ``` +## Security Assessment + +### Data Flow Diagram + +```mermaid +%%{init: {"flowchart": {"curve": "linear"} }}%% +flowchart LR + DC(Data Consumer) + DP(Data Provider) + K(Keycloak) + + subgraph Semantic Hub + SH(Sematic Hub) + end + + SH <-->|Find submodels / metadata| DC + SH <-->|Submodel creation \n provide metadata| DP + + K -->|Public key for token validation| SH + + DC <-->|Token request| K + DP <-->|Token request| K +``` ### NOTICE @@ -87,4 +110,4 @@ This work is licensed under the [Apache-2.0](https://www.apache.org/licenses/LIC - SPDX-License-Identifier: Apache-2.0 - SPDX-FileCopyrightText: 2023 Robert Bosch Manufacturing Solutions GmbH - SPDX-FileCopyrightText: 2023 Contributors to the Eclipse Foundation -- Source URL: https://github.com/eclipse-tractusx/sldt-semantic-hub.git \ No newline at end of file +- Source URL: https://github.com/eclipse-tractusx/sldt-semantic-hub.git From 4f90018c2f2576187a56f89812a620cd4f33707b Mon Sep 17 00:00:00 2001 From: Sebastian Scherer <59142915+scherersebastian@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:05:08 +0100 Subject: [PATCH 03/27] docs: add backend to dfd --- docs/documentation.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/documentation.md b/docs/documentation.md index 3de2da05..addc2827 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -91,13 +91,16 @@ flowchart LR K(Keycloak) subgraph Semantic Hub - SH(Sematic Hub) + SHB(Semantic Hub Backend) + SH(Sematic Hub postgres) end - SH <-->|Find submodels / metadata| DC - SH <-->|Submodel creation \n provide metadata| DP + SHB <-->|Find submodels / metadata| DC + SHB <-->|Submodel creation \n provide metadata| DP - K -->|Public key for token validation| SH + SHB <--> SH + + K -->|Public key for token validation| SHB DC <-->|Token request| K DP <-->|Token request| K From a9792b5fb2be8d7218592f679f110e37f52df50c Mon Sep 17 00:00:00 2001 From: Sebastian Scherer <59142915+scherersebastian@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:25:26 +0100 Subject: [PATCH 04/27] docs: postgres in db shape --- docs/documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation.md b/docs/documentation.md index addc2827..d8304995 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -92,7 +92,7 @@ flowchart LR subgraph Semantic Hub SHB(Semantic Hub Backend) - SH(Sematic Hub postgres) + SH[(Sematic Hub postgres)] end SHB <-->|Find submodels / metadata| DC From c74a8be051bf7d49bcbb166369a8347f4239d79b Mon Sep 17 00:00:00 2001 From: Simone Lindner Date: Thu, 9 Nov 2023 08:43:29 +0100 Subject: [PATCH 05/27] legal header information corrected --- .../generate-dependencies-notice/action.yml | 2 +- .../generate-dependencies-notice/index.js | 2 +- .github/workflows/gitleaks.yml | 2 +- .github/workflows/helm-release.yml | 2 +- .github/workflows/helm-test.yml | 2 +- .github/workflows/kics.yml | 2 +- .../workflows/publish-image-semantic-hub.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/trivy.yml | 2 +- .github/workflows/veracode.yaml | 2 +- charts/semantic-hub/Chart.yaml | 2 +- .../templates/graphdb/graphdb-deployment.yaml | 36 +++++++++---------- .../templates/graphdb/graphdb-pvc.yaml | 4 +-- .../templates/graphdb/graphdb-service.yaml | 36 +++++++++---------- .../templates/hub/hub-ingress.yaml | 36 +++++++++---------- 15 files changed, 67 insertions(+), 67 deletions(-) diff --git a/.github/actions/generate-dependencies-notice/action.yml b/.github/actions/generate-dependencies-notice/action.yml index ee404526..bcc3355e 100644 --- a/.github/actions/generate-dependencies-notice/action.yml +++ b/.github/actions/generate-dependencies-notice/action.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/actions/generate-dependencies-notice/index.js b/.github/actions/generate-dependencies-notice/index.js index 8590d425..3eace487 100644 --- a/.github/actions/generate-dependencies-notice/index.js +++ b/.github/actions/generate-dependencies-notice/index.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH Copyright (c) 2023 Contributors to the Eclipse Foundation See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index 08cd4860..3055adce 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2021-2022 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/helm-release.yml b/.github/workflows/helm-release.yml index 3e64fdf2..c9add9cd 100644 --- a/.github/workflows/helm-release.yml +++ b/.github/workflows/helm-release.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2021-2022 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 04ec98e2..6b196f90 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/kics.yml b/.github/workflows/kics.yml index e9ae7138..4354f50c 100644 --- a/.github/workflows/kics.yml +++ b/.github/workflows/kics.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2021-2022 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/publish-image-semantic-hub.yml b/.github/workflows/publish-image-semantic-hub.yml index 635a1a43..458c86f3 100644 --- a/.github/workflows/publish-image-semantic-hub.yml +++ b/.github/workflows/publish-image-semantic-hub.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b21c238a..7e81c69f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 0ae3c18a..cdf7fe87 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021-2022 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2021-2022 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/.github/workflows/veracode.yaml b/.github/workflows/veracode.yaml index fa05c59b..c1c13b7f 100644 --- a/.github/workflows/veracode.yaml +++ b/.github/workflows/veracode.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional diff --git a/charts/semantic-hub/Chart.yaml b/charts/semantic-hub/Chart.yaml index d86c3ca1..037ca841 100644 --- a/charts/semantic-hub/Chart.yaml +++ b/charts/semantic-hub/Chart.yaml @@ -26,7 +26,7 @@ sources: - https://github.com/eclipse-tractusx/sldt-semantic-hub type: application -version: 0.1.31 +version: 0.1.32 appVersion: 0.2.14 dependencies: - repository: https://charts.bitnami.com/bitnami diff --git a/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml b/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml index ac13a375..a8792e50 100644 --- a/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml +++ b/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml @@ -1,24 +1,24 @@ -{{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} ############################################################### # Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -############################################################### + # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License, Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0. + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + # + # SPDX-License-Identifier: Apache-2.0 + ############################################################### +{{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} {{- $deployment_name := printf "cx-%s-graphdb" .Release.Name }} {{- $sec_name := printf "%s-sec" $deployment_name }} {{- $pvc_name := printf "%s-pvc" $deployment_name }} diff --git a/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml b/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml index caa6fefc..bc9e3b15 100644 --- a/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml +++ b/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml @@ -1,5 +1,4 @@ -{{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} - ############################################################### +############################################################### # Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation # @@ -19,6 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### +{{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} {{- $deployment_name := printf "cx-%s-graphdb" .Release.Name }} {{- $pvc_name := printf "%s-pvc" $deployment_name }} apiVersion: v1 diff --git a/charts/semantic-hub/templates/graphdb/graphdb-service.yaml b/charts/semantic-hub/templates/graphdb/graphdb-service.yaml index 3b30c59f..71e297b0 100644 --- a/charts/semantic-hub/templates/graphdb/graphdb-service.yaml +++ b/charts/semantic-hub/templates/graphdb/graphdb-service.yaml @@ -1,24 +1,24 @@ -{{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} ############################################################### # Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -############################################################### + # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License, Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0. + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + # + # SPDX-License-Identifier: Apache-2.0 + ############################################################### +{{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} {{- $deployment_name := printf "cx-%s-graphdb" .Release.Name }} {{- $service_name := printf "cx-%s-graphdb-svc" .Release.Name }} apiVersion: v1 diff --git a/charts/semantic-hub/templates/hub/hub-ingress.yaml b/charts/semantic-hub/templates/hub/hub-ingress.yaml index 1eb3e068..639b9bc0 100644 --- a/charts/semantic-hub/templates/hub/hub-ingress.yaml +++ b/charts/semantic-hub/templates/hub/hub-ingress.yaml @@ -1,24 +1,24 @@ -{{- if .Values.hub.ingress.enabled }} ############################################################### # Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -############################################################### + # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License, Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0. + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + # + # SPDX-License-Identifier: Apache-2.0 + ############################################################### +{{- if .Values.hub.ingress.enabled }} {{- $deployment_name := printf "cx-%s-hub" .Release.Name }} {{- $svc_name := printf "%s-svc" $deployment_name }} {{- $ingr_name := printf "%s-ingr" $deployment_name }} From a87f460cd149daa51814bfd1606e6b12a39f9958 Mon Sep 17 00:00:00 2001 From: Tunahan Cicek Date: Tue, 14 Nov 2023 10:53:23 +0100 Subject: [PATCH 06/27] add automated Tests --- .github/workflows/semantic-hub-e2e-test.yml | 69 ++++ e2e-tests/requirements.txt | 3 + e2e-tests/semantic-hub/common.yaml | 73 ++++ e2e-tests/semantic-hub/test_api.tavern.yaml | 400 ++++++++++++++++++++ 4 files changed, 545 insertions(+) create mode 100644 .github/workflows/semantic-hub-e2e-test.yml create mode 100644 e2e-tests/requirements.txt create mode 100644 e2e-tests/semantic-hub/common.yaml create mode 100644 e2e-tests/semantic-hub/test_api.tavern.yaml diff --git a/.github/workflows/semantic-hub-e2e-test.yml b/.github/workflows/semantic-hub-e2e-test.yml new file mode 100644 index 00000000..3a4a3548 --- /dev/null +++ b/.github/workflows/semantic-hub-e2e-test.yml @@ -0,0 +1,69 @@ +############################################################### +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### +name: Semantic-hub End-to-End tests + +on: + workflow_dispatch: + inputs: + bearerToken: + description: 'bearerToken' + required: true + semantichubUrl: + description: 'semantic-hub-Url' + required: true + +jobs: + end_to_end_tests: + runs-on: ubuntu-latest + name: Execute End-to-End tests + + steps: + - name: Mask Input Credentials + run: | + mask_client_bearer_token=$(jq -r '.inputs.bearerToken' $GITHUB_EVENT_PATH) + echo ::add-mask::$mask_client_bearer_token + echo mask_client_bearer_token=$mask_client_bearer_token >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + check-latest: true + + - name: Install python dependencies + working-directory: ./e2e-tests + run: | + pip install -r requirements.txt + + - name: Install python dependencies + working-directory: ./e2e-tests/semantic-hub + run: | + py.test . -vv --html=./output/report.html --self-contained-html + env: + BEARER_TOKEN: ${{ env.mask_client_bearer_token }} + SEMANTIC_HUB_API_URL: ${{ inputs.semantichubUrl }} + - name: Upload test report + uses: actions/upload-artifact@v3 + if: always() + with: + name: semantic-hub-e2e-test-report + path: ./e2e-tests/semantic-hub/output/report.html \ No newline at end of file diff --git a/e2e-tests/requirements.txt b/e2e-tests/requirements.txt new file mode 100644 index 00000000..f1c58910 --- /dev/null +++ b/e2e-tests/requirements.txt @@ -0,0 +1,3 @@ +pytest==7.1.2 +tavern==1.23.3 +pytest-html==3.1.1 diff --git a/e2e-tests/semantic-hub/common.yaml b/e2e-tests/semantic-hub/common.yaml new file mode 100644 index 00000000..a98a8d71 --- /dev/null +++ b/e2e-tests/semantic-hub/common.yaml @@ -0,0 +1,73 @@ +############################################################### +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### +name: Common variable definitions +description: + Contains common variable definitions. + +variables: + semantic_hub_api_url: "{tavern.env_vars.SEMANTIC_HUB_API_URL}" + bearer_token: "{tavern.env_vars.BEARER_TOKEN}" + model_bamm_urn: urn:bamm:org.eclipse.tractusx.semantics.test:1.0.0#EndToEndTest + model_bamm_urn_encoded: urn%3Abamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23EndToEndTest + model_bamm_package_urn_encoded: urn%3Abamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23 + model_bamm_name: EndToEndTest + model_bamm_version: 1.0.0 + model_bamm_ttl: | + @prefix : . + @prefix bamm: . + @prefix bamm-c: . + @prefix xsd: . + + :EndToEndTest + a bamm:Aspect ; + bamm:name "EndToEndTest" ; + bamm:preferredName "EndToEndTest en"@en ; + bamm:preferredName "EndToEndTest de"@de ; + bamm:properties ( :detail ) ; + bamm:operations ( ) . + + :detail a bamm:Property ; + bamm:name "testString" ; + bamm:exampleValue "Example Value Test" ; + bamm:characteristic bamm-c:Text . + + model_samm_urn: urn:samm:org.eclipse.tractusx.semantics.test:1.0.0#EndToEndTest + model_samm_urn_encoded: urn%3Asamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23EndToEndTest + model_samm_package_urn_encoded: urn%3Asamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23 + model_samm_name: EndToEndTest + model_samm_version: 1.0.0 + model_samm_ttl: | + @prefix : . + @prefix samm: . + @prefix bamm-c: . + @prefix xsd: . + + :EndToEndTest + a samm:Aspect ; + samm:name "EndToEndTest" ; + samm:preferredName "EndToEndTest en"@en ; + samm:preferredName "EndToEndTest de"@de ; + samm:properties ( :detail ) ; + samm:operations ( ) . + + :detail a samm:Property ; + samm:name "testString" ; + samm:exampleValue "Example Value Test" ; + samm:characteristic bamm-c:Text . \ No newline at end of file diff --git a/e2e-tests/semantic-hub/test_api.tavern.yaml b/e2e-tests/semantic-hub/test_api.tavern.yaml new file mode 100644 index 00000000..b80bce9f --- /dev/null +++ b/e2e-tests/semantic-hub/test_api.tavern.yaml @@ -0,0 +1,400 @@ +############################################################### +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### +test_name: Test APIs are protected with authentication + +includes: + - !include common.yaml + +stages: + - name: Test get models without access token + request: + url: "{semantic_hub_api_url:s}/api/v1/models?pageSize=10&page=0" + method: GET + response: + status_code: 401 + + - name: Authenticated request + request: + url: "{semantic_hub_api_url:s}/api/v1/models?pageSize=10&page=0" + method: GET + headers: + Content-Type: application/json + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + +--- +test_name: Test create, read, update and delete a model for BAMM + +includes: + - !include common.yaml + +stages: + - name: Create model expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models?status=DRAFT&type=BAMM" + method: POST + headers: + Content-Type: text/plain + Accept: application/json + Authorization: "Bearer {bearer_token:s}" + data: "{model_bamm_ttl:s}" + + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model by urn + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}" + method: GET + headers: + Content-Type: application/json + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + json: + urn: "{model_bamm_urn:s}" + version: "{model_bamm_version:s}" + name: "{model_bamm_name:s}" + type: BAMM + status: DRAFT + + - name: Update model + request: + url: "{semantic_hub_api_url:s}/api/v1/models?status=DRAFT&type=BAMM" + method: PUT + headers: + Content-Type: text/plain + Accept: application/json + Authorization: "Bearer {bearer_token:s}" + data: "{model_bamm_ttl:s}" + + response: + status_code: 200 + json: + urn: "{model_bamm_urn:s}" + version: "{model_bamm_version:s}" + name: "{model_bamm_name:s}" + type: BAMM + status: DRAFT + + - name: Delete model by package urn + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_package_urn_encoded:s}" + method: DELETE + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 204 + +--- + +test_name: Test create, read, update and delete a model for SAMM + +includes: + - !include common.yaml + +stages: + - name: Create model expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models?status=DRAFT&type=SAMM" + method: POST + headers: + Content-Type: text/plain + Accept: application/json + Authorization: "Bearer {bearer_token:s}" + data: "{model_samm_ttl:s}" + + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model by urn + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}" + method: GET + headers: + Content-Type: application/json + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + json: + urn: "{model_samm_urn:s}" + version: "{model_samm_version:s}" + name: "{model_samm_name:s}" + type: SAMM + status: DRAFT + + - name: Update model + request: + url: "{semantic_hub_api_url:s}/api/v1/models?status=DRAFT&type=SAMM" + method: PUT + headers: + Content-Type: text/plain + Accept: application/json + Authorization: "Bearer {bearer_token:s}" + data: "{model_samm_ttl:s}" + + response: + status_code: 200 + json: + urn: "{model_samm_urn:s}" + version: "{model_samm_version:s}" + name: "{model_samm_name:s}" + type: SAMM + status: DRAFT + + - name: Delete model by package urn + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_package_urn_encoded:s}" + method: DELETE + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 204 + +--- + +test_name: Test model artifcat generation for BAMM + +includes: + - !include common.yaml + +stages: + - name: Create model expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models?status=DRAFT&type=BAMM" + method: POST + headers: + Content-Type: text/plain + Accept: application/json + Authorization: "Bearer {bearer_token:s}" + data: "{model_bamm_ttl:s}" + + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model as file expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/file" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: text/turtle;charset=UTF-8 + + - name: Get model as diagram expect success + skip: True + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/diagram" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: image/png + + - name: Get model as documentation expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/documentation" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: text/html + + - name: Get model as json-schema expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/json-schema" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/schema+json + + - name: Get model as openapi expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/openapi?baseUrl=example.com" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model as example-payload expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/example-payload" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model as aasx expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_urn_encoded:s}/aas" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/xml + + - name: Delete model by package urn (cleanup) + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_bamm_package_urn_encoded:s}" + method: DELETE + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 204 + +--- + +test_name: Test model artifcat generation for SAMM + +includes: + - !include common.yaml + +stages: + - name: Create model expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models?status=DRAFT&type=SAMM" + method: POST + headers: + Content-Type: text/plain + Accept: application/json + Authorization: "Bearer {bearer_token:s}" + data: "{model_samm_ttl:s}" + + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model as file expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/file" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: text/turtle;charset=UTF-8 + + - name: Get model as diagram expect success + skip: True + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/diagram" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: image/png + + - name: Get model as documentation expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/documentation" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: text/html + + - name: Get model as json-schema expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/json-schema" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/schema+json + + - name: Get model as openapi expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/openapi?baseUrl=example.com" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model as example-payload expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/example-payload" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/json + + - name: Get model as aasx expect success + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_urn_encoded:s}/aas" + method: GET + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 200 + headers: + content-type: application/xml + + - name: Delete model by package urn (cleanup) + request: + url: "{semantic_hub_api_url:s}/api/v1/models/{model_samm_package_urn_encoded:s}" + method: DELETE + headers: + Authorization: "Bearer {bearer_token:s}" + response: + status_code: 204 \ No newline at end of file From d214a14a1515295ea7ea025d79a12d3af834e5f5 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 10:20:23 +0100 Subject: [PATCH 07/27] helm upgrade --- .github/workflows/helm-test.yml | 14 ++++++++++++++ CHANGELOG.md | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 6b196f90..4708c355 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -29,6 +29,11 @@ on: default: 'kindest/node:v1.24.6' required: false type: string + upgrade_from: + description: 'chart version to upgrade from' + default: '0.1.32' + required: false + type: string jobs: lint-test: @@ -68,3 +73,12 @@ jobs: - name: Run chart-testing (install) run: ct install --charts charts/semantic-hub --config charts/chart-testing-config.yaml if: steps.list-changed.outputs.changed == 'true' + + - name: Run helm upgrade + run: | + helm repo add bitnami https://charts.bitnami.com/bitnami + helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev + helm install semantic-hub tractusx-dev/semantic-hub --version ${{ github.event.inputs.upgrade_from || '0.1.32' }} + helm dependency update charts/semantic-hub + helm upgrade semantic-hub charts/semantic-hub + if: steps.list-changed.outputs.changed == 'true' diff --git a/CHANGELOG.md b/CHANGELOG.md index a65dcc76..7461163a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.2.15 +### Added +- Added helm upgrade feature into helm test + +## fixed + ## 0.2.14 ### Added From 102c6b97574ce7cde1a1d293da90b8097551d1e4 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 10:22:05 +0100 Subject: [PATCH 08/27] test helm upgrade --- charts/semantic-hub/Chart.yaml | 2 +- charts/semantic-hub/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/semantic-hub/Chart.yaml b/charts/semantic-hub/Chart.yaml index 037ca841..44a05e93 100644 --- a/charts/semantic-hub/Chart.yaml +++ b/charts/semantic-hub/Chart.yaml @@ -26,7 +26,7 @@ sources: - https://github.com/eclipse-tractusx/sldt-semantic-hub type: application -version: 0.1.32 +version: 0.1.33 appVersion: 0.2.14 dependencies: - repository: https://charts.bitnami.com/bitnami diff --git a/charts/semantic-hub/values.yaml b/charts/semantic-hub/values.yaml index bff4f57d..b42093e3 100644 --- a/charts/semantic-hub/values.yaml +++ b/charts/semantic-hub/values.yaml @@ -65,7 +65,7 @@ hub: memory: 1024Mi requests: cpu: 250m - memory: 1024Mi + memory: 1025Mi graphdb: ## Include Fuski deployment or deploy separately From d49277635e33e0678e1d473d85d54b92ec421eea Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 10:25:32 +0100 Subject: [PATCH 09/27] test helm upgrade --- charts/semantic-hub/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/semantic-hub/values.yaml b/charts/semantic-hub/values.yaml index b42093e3..12d9ed5b 100644 --- a/charts/semantic-hub/values.yaml +++ b/charts/semantic-hub/values.yaml @@ -65,7 +65,7 @@ hub: memory: 1024Mi requests: cpu: 250m - memory: 1025Mi + memory: 1023Mi graphdb: ## Include Fuski deployment or deploy separately From dcfea5b5484563a2e2cb4e5716a1a265bf4daaf2 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 10:31:53 +0100 Subject: [PATCH 10/27] reverted test helm upgrade --- charts/semantic-hub/Chart.yaml | 2 +- charts/semantic-hub/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/semantic-hub/Chart.yaml b/charts/semantic-hub/Chart.yaml index 44a05e93..037ca841 100644 --- a/charts/semantic-hub/Chart.yaml +++ b/charts/semantic-hub/Chart.yaml @@ -26,7 +26,7 @@ sources: - https://github.com/eclipse-tractusx/sldt-semantic-hub type: application -version: 0.1.33 +version: 0.1.32 appVersion: 0.2.14 dependencies: - repository: https://charts.bitnami.com/bitnami diff --git a/charts/semantic-hub/values.yaml b/charts/semantic-hub/values.yaml index 12d9ed5b..bff4f57d 100644 --- a/charts/semantic-hub/values.yaml +++ b/charts/semantic-hub/values.yaml @@ -65,7 +65,7 @@ hub: memory: 1024Mi requests: cpu: 250m - memory: 1023Mi + memory: 1024Mi graphdb: ## Include Fuski deployment or deploy separately From 035b8a6c13c92b20e5d27201f25695938849e5cd Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 16:08:11 +0100 Subject: [PATCH 11/27] initial revision --- .../semantics/ApiExceptionHandler.java | 24 ++++++++++++------- .../tractusx/semantics/hub/ModelsApiTest.java | 11 +++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/semantics/ApiExceptionHandler.java b/backend/src/main/java/org/eclipse/tractusx/semantics/ApiExceptionHandler.java index 3a600e75..1802ed18 100644 --- a/backend/src/main/java/org/eclipse/tractusx/semantics/ApiExceptionHandler.java +++ b/backend/src/main/java/org/eclipse/tractusx/semantics/ApiExceptionHandler.java @@ -24,6 +24,14 @@ import java.util.Map; import java.util.stream.Collectors; +import org.eclipse.esmf.aspectmodel.urn.UrnSyntaxException; +import org.eclipse.tractusx.semantics.hub.AspectModelNotFoundException; +import org.eclipse.tractusx.semantics.hub.EntityNotFoundException; +import org.eclipse.tractusx.semantics.hub.InvalidAspectModelException; +import org.eclipse.tractusx.semantics.hub.InvalidStateTransitionException; +import org.eclipse.tractusx.semantics.hub.ModelPackageNotFoundException; +import org.eclipse.tractusx.semantics.hub.model.Error; +import org.eclipse.tractusx.semantics.hub.model.ErrorResponse; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -35,14 +43,6 @@ import org.springframework.web.context.request.WebRequest; import org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; -import org.eclipse.tractusx.semantics.hub.AspectModelNotFoundException; -import org.eclipse.tractusx.semantics.hub.EntityNotFoundException; -import org.eclipse.tractusx.semantics.hub.InvalidAspectModelException; -import org.eclipse.tractusx.semantics.hub.InvalidStateTransitionException; - -import org.eclipse.tractusx.semantics.hub.ModelPackageNotFoundException; -import org.eclipse.tractusx.semantics.hub.model.Error; -import org.eclipse.tractusx.semantics.hub.model.ErrorResponse; import jakarta.servlet.http.HttpServletRequest; @@ -124,4 +124,12 @@ public ResponseEntity handleInvalidStateTransitionException( fina .path( request.getRequestURI() ) ), HttpStatus.BAD_REQUEST ); } + @ExceptionHandler( { UrnSyntaxException.class } ) + public ResponseEntity handleInvalidStateTransitionException( final HttpServletRequest request, final UrnSyntaxException exception ) { + return new ResponseEntity<>( new ErrorResponse() + .error( new Error() + .message( exception.getMessage() ) + .path( request.getRequestURI() ) ), HttpStatus.BAD_REQUEST ); + } + } diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java b/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java index 0f324147..5313b742 100644 --- a/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java @@ -923,4 +923,15 @@ public void testDependentModelBAMM() throws Exception { private static String toMovementUrn(String urn){ return urn + "Movement"; } + + @Test + public void testGetModelByURNWithInvalidURN() throws Exception { + String urnPrefix = "urn:invalid"; + mvc.perform( MockMvcRequestBuilders.get( "/api/v1/models/{urn}", urnPrefix ).with( jwtTokenFactory.allRoles() ) ) + .andDo( MockMvcResultHandlers.print() ) + .andExpect( status().is4xxClientError() ) + .andExpect( jsonPath( "$.error.message", is( + "The URN must consist of at least 5 sections adhering to the following schema: " + + "urn:samm::::." ) ) ); + } } \ No newline at end of file From 893c739f1a4abf65c790b4cace325553fb22bbc2 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 16:30:28 +0100 Subject: [PATCH 12/27] updated CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a65dcc76..a8569338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.2.15 +### Added + +### Fixed +- Handled exception for invalid urn format. + ## 0.2.14 ### Added From a2405adc0b42cd226ff86277caadce2d0fbbf4b6 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 15 Nov 2023 16:32:17 +0100 Subject: [PATCH 13/27] updated CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8569338..7bb4d2f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Fixed -- Handled exception for invalid urn format. +- Handled UrnSyntaxException. ## 0.2.14 ### Added From 28001488dfb559dc5fba8872e15f6f091ee8f899 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Thu, 16 Nov 2023 07:37:55 +0100 Subject: [PATCH 14/27] corrected the assertion for specific error --- .../java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java b/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java index 5313b742..6295b224 100644 --- a/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/hub/ModelsApiTest.java @@ -929,7 +929,7 @@ public void testGetModelByURNWithInvalidURN() throws Exception { String urnPrefix = "urn:invalid"; mvc.perform( MockMvcRequestBuilders.get( "/api/v1/models/{urn}", urnPrefix ).with( jwtTokenFactory.allRoles() ) ) .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().is4xxClientError() ) + .andExpect( status().isBadRequest() ) .andExpect( jsonPath( "$.error.message", is( "The URN must consist of at least 5 sections adhering to the following schema: " + "urn:samm::::." ) ) ); From a31b814f1fb577f4bd936e9052d6648162c36a78 Mon Sep 17 00:00:00 2001 From: Sebastian Bezold Date: Tue, 21 Nov 2023 11:11:23 +0100 Subject: [PATCH 15/27] chore(build): bump default kind k8s node version --- .github/workflows/helm-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 6b196f90..51f48d2e 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -26,7 +26,7 @@ on: node_image: description: 'kindest/node image for k8s kind cluster' # k8s version from 3.1 release as default - default: 'kindest/node:v1.24.6' + default: 'kindest/node:v1.27.3' required: false type: string @@ -41,6 +41,9 @@ jobs: - name: Kubernetes KinD Cluster uses: container-tools/kind-action@v1 + with: + # upgrade version, default (v0.17.0) uses node image v1.21.1 and doesn't work with more recent node image versions + version: v0.20.0 - name: Set up Helm uses: azure/setup-helm@v3 From 0c1fec23a1b7c41f77f88d086fafdd883e6e7ece Mon Sep 17 00:00:00 2001 From: Simone Lindner Date: Tue, 21 Nov 2023 12:48:24 +0100 Subject: [PATCH 16/27] apply updated SECURITY.md --- SECURITY.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 1c3f1692..f9e8c992 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,17 @@ -# Security Policy - ## Reporting a Vulnerability -Please report a found vulnerability here: -[https://www.eclipse.org/security/](https://www.eclipse.org/security/) +Please do **not** report security vulnerabilities through public GitHub issues. + +Please report vulnerabilities to this repository via **GitHub security advisories** instead. + +How? Inside affected repository → security tab + +for contributor: +→ Report a vulnerability + +for committer: +→ advisories → New draft security advisory + +In severe cases, you can also report a found vulnerability via mail or eclipse issue here: https://www.eclipse.org/security/ + +See [Eclipse Foundation Vulnerability Reporting Policy](https://www.eclipse.org/projects/handbook/#vulnerability) \ No newline at end of file From e511f18a34da14ee47a1912e021140d2cd65e033 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Tue, 21 Nov 2023 13:47:28 +0100 Subject: [PATCH 17/27] changed to Capital letter --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 664a9d6b..34f89dc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added helm upgrade feature into helm test -## fixed +## Fixed - Handled UrnSyntaxException. ## 0.2.14 From c7adac75c1ec35c563af020d94a7da6366016e1e Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Tue, 21 Nov 2023 13:48:14 +0100 Subject: [PATCH 18/27] corrected the format --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f89dc9..82a0a338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added helm upgrade feature into helm test -## Fixed +### Fixed - Handled UrnSyntaxException. ## 0.2.14 From ec486c848ee19cf5b8a53fa6001b91adb134998e Mon Sep 17 00:00:00 2001 From: Sebastian Bezold Date: Tue, 21 Nov 2023 14:07:28 +0100 Subject: [PATCH 19/27] chore(build): only skip ct install on PRs --- .github/workflows/helm-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 4708c355..c6b006b9 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -72,7 +72,7 @@ jobs: - name: Run chart-testing (install) run: ct install --charts charts/semantic-hub --config charts/chart-testing-config.yaml - if: steps.list-changed.outputs.changed == 'true' + if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' - name: Run helm upgrade run: | From 42e2a9e8e654e3d8f9b8a33d0c285822646c0c70 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Tue, 21 Nov 2023 15:02:56 +0100 Subject: [PATCH 20/27] initial revision --- backend/Dockerfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index faa7ed36..5f7fc5d2 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -26,11 +26,6 @@ RUN mvn package -DskipTests FROM eclipse-temurin:17-jre-alpine -RUN apk --no-cache upgrade \ - && apk --no-cache update \ - && apk --no-cache add graphviz \ - && rm -rf /var/cache/apk/* - RUN addgroup -g 101 -S spring \ && adduser -u 100 -S spring -G spring \ && mkdir -p /service \ From b646d6c907754e9108dca7a501fb18eccd33e9e9 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Tue, 21 Nov 2023 15:09:15 +0100 Subject: [PATCH 21/27] Updated the CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a65dcc76..f7a0dcdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.2.15 +### Added +- Removed the docker apk upgrade and update commands. + +### Fixed + ## 0.2.14 ### Added From 77eea3ae2c6bae9317144cfccb308137e55aa424 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 22 Nov 2023 09:08:35 +0100 Subject: [PATCH 22/27] Updated CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bc68f9c..b5e9c285 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.2.15 ### Added +- Added helm upgrade feature into helm test - Removed the docker apk upgrade and update commands. ### Fixed ======= -- Added helm upgrade feature into helm test - Handled UrnSyntaxException. ## 0.2.14 From 80da30014601b25807188e4b8bfa75ddb9810d84 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 22 Nov 2023 11:41:13 +0100 Subject: [PATCH 23/27] updated helm-test.yml --- .github/workflows/helm-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 8bebe307..be439d4e 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -84,4 +84,4 @@ jobs: helm install semantic-hub tractusx-dev/semantic-hub --version ${{ github.event.inputs.upgrade_from || '0.1.32' }} helm dependency update charts/semantic-hub helm upgrade semantic-hub charts/semantic-hub - if: steps.list-changed.outputs.changed == 'true' + if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' From 51c12d0a2bbe4ccb9771dcb692f127bc9e7b4a9f Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 22 Nov 2023 14:55:36 +0100 Subject: [PATCH 24/27] updated Fuseki version to 4.7.0 --- .../org/eclipse/tractusx/semantics/FusekiTestContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/FusekiTestContainer.java b/backend/src/test/java/org/eclipse/tractusx/semantics/FusekiTestContainer.java index 1d9e5f74..4c357f80 100644 --- a/backend/src/test/java/org/eclipse/tractusx/semantics/FusekiTestContainer.java +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/FusekiTestContainer.java @@ -26,7 +26,7 @@ public class FusekiTestContainer { private static final int PORT = 3030; - private static final String IMAGE = "jena-fuseki-docker"; + private static final String IMAGE = "jena-fuseki-docker:4.7.0"; private static final String CONTAINER_NAME = "fuseki-container"; public static final GenericContainer FUSEKI_CONTAINER = From 3365988ece824d56ae4ac649316b0f673ea581ef Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Wed, 22 Nov 2023 14:56:51 +0100 Subject: [PATCH 25/27] Updated CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a65dcc76..773ca12e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.2.15 +### Added + +### Fixed +- Fixed the jena-fuseki-docker version to 4.7.0 for the test case. + ## 0.2.14 ### Added From 0ae3da270a580055597e4e05e11e642448a29e48 Mon Sep 17 00:00:00 2001 From: RHJ5FE Date: Thu, 23 Nov 2023 08:23:54 +0100 Subject: [PATCH 26/27] added jena-fuseki-docker version to 4.7.0 --- .github/workflows/build-snapshot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-snapshot.yml b/.github/workflows/build-snapshot.yml index 133688fb..00081160 100644 --- a/.github/workflows/build-snapshot.yml +++ b/.github/workflows/build-snapshot.yml @@ -54,7 +54,7 @@ jobs: run: | unzip jena-fuseki.zip cd jena-fuseki-docker-$FUSEKI_VERSION - docker build --build-arg JENA_VERSION=$FUSEKI_VERSION -t jena-fuseki-docker . + docker build --build-arg JENA_VERSION=$FUSEKI_VERSION -t jena-fuseki-docker:4.7.0 . - name: Build and Deploy with Maven run: mvn clean install env: From ae188a599fce2e12c4dace8d9675b13abe4e85ef Mon Sep 17 00:00:00 2001 From: Simone Lindner Date: Fri, 24 Nov 2023 09:23:58 +0100 Subject: [PATCH 27/27] fixes for trivy scan failure --- .github/workflows/trivy.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index cdf7fe87..853ca1ec 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -35,15 +35,14 @@ jobs: uses: actions/checkout@v3 - name: Run Trivy vulnerability scanner in repo mode - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@0.14.0 with: scan-type: "config" # ignore-unfixed: true - exit-code: "1" hide-progress: false format: "sarif" output: "trivy-results1.sarif" - severity: "CRITICAL,HIGH" + vuln-type: "os,library" - name: Upload Trivy scan results to GitHub Security tab uses: github/codeql-action/upload-sarif@v2 @@ -70,15 +69,14 @@ jobs: run: mvn clean package -DskipTests - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@0.14.0 with: image-ref: "tractusx/sldt-semantic-hub:latest" # ignore-unfixed: true - exit-code: "1" hide-progress: false format: "sarif" output: "trivy-results-semantic-hub.sarif" - severity: "CRITICAL,HIGH" + vuln-type: "os,library" - name: Upload Trivy scan results to GitHub Security tab uses: github/codeql-action/upload-sarif@v2