From b2ce6c5ea9e027a522d2d67206a60684a6b673b4 Mon Sep 17 00:00:00 2001 From: --show-origin Date: Fri, 26 Jul 2024 04:41:46 -0700 Subject: [PATCH 1/2] feat: add supporting tools for QGate checks --- .act/workflow_dispatch_helm_test.json | 7 ++ docs/DEVELOPMENT.md | 27 +++++++ scripts/license-check.py | 111 ++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 .act/workflow_dispatch_helm_test.json create mode 100644 scripts/license-check.py diff --git a/.act/workflow_dispatch_helm_test.json b/.act/workflow_dispatch_helm_test.json new file mode 100644 index 00000000..8a057e89 --- /dev/null +++ b/.act/workflow_dispatch_helm_test.json @@ -0,0 +1,7 @@ +{ + "inputs": { + "node_image": "kindest/node:v1.28.9", + "upgrade_from": "", + "helm_version": "latest" + } +} diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index fcb03b7e..383d2cd6 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -243,6 +243,33 @@ act --list act --job lint-test -e .act/pr-event.json ``` +# Notes on the release + +## Run helm test locally for n kubernetes versions + +Using act, you can run workflows locally. If you want to test how to use the workflow, update the file +`.act/workflow_dispatch_helm_test.json` that contains the input parameters. + +Check for supported kubernetes versions of kind per [release](https://github.com/kubernetes-sigs/kind/releases). + +```shell +# root dir +act workflow_dispatch -j lint-test -e .act/workflow_dispatch_helm_test.json +``` + + +## Check license files + +For easier checks we created a small python script to check license files. + +It searches for the common contributor (Contributors to the EF) and prints files, not containing that + +```shell +cd scripts + +python3 license-check.py +``` + ## NOTICE This work is licensed under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0). diff --git a/scripts/license-check.py b/scripts/license-check.py new file mode 100644 index 00000000..c3f57296 --- /dev/null +++ b/scripts/license-check.py @@ -0,0 +1,111 @@ +# +# Copyright (c) 2024 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. (represented by Fraunhofer ISST) +# Copyright (c) 2024 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 +# + +import os + +# Search above /scripts (root) +directory = "../." +license_header = """Contributors to the Eclipse Foundation""" + +# don't check SE life cycle folders +blacklisted_folders = [ + "node_modules", + ".git", + "build", + "target", + "dist", + ".idea", + ".mvn" +] + +# exclude non_code artifacts +excluded_extensions = [ + ".png", + ".jpg", + ".gif", + ".pdf", + ".md", + ".svg", + ".puml", + ".properties", + ".keys", + ".secret", + ".key", + ".iml", + ".txt", + ".json", + ".ico", + ".jsonld", + ".tgz", + ".cert", + ".pem", + ".conf" +] + +# exclude specific files by name patterns +excluded_file_patterns = [ + "README", + "LICENSE", + "config", + ".gitignore", + ".helmignore", + ".prettierrc", + ".env", + "mvnw", + "DEPENDENCIES" +] + +def file_contains_license(file_path, license_header): + with open(file_path, 'r', encoding='utf-8', errors='ignore') as file: + content = file.read() + return license_header in content + +def find_files_without_license(directory, license_header, blacklisted_folders): + files_without_license = [] + for root, _, files in os.walk(directory): + if any(blacklisted_folder in root for blacklisted_folder in blacklisted_folders): + continue + for file in files: + file_path = os.path.join(root, file) + + # Skip files with excluded extensions + if any(file.endswith(ext) for ext in excluded_extensions): + print(f"Skipping excluded file: {file_path}") + continue + + # Skip specific excluded files by start pattern + if any(file.startswith(pattern) for pattern in excluded_file_patterns): + print(f"Skipping specific excluded file by pattern: {file_path}") + continue + + if not file_contains_license(file_path, license_header): + files_without_license.append(file_path) + return files_without_license + +# Run the script +files_without_license = find_files_without_license(directory, license_header, blacklisted_folders) + +# Print the list of files without the license header +if files_without_license: + print("Files without the license header:") + for file in files_without_license: + print(file) +else: + print("All files contain the license header.") From a725213643fe03d63f740d772ee2d8fa66425e17 Mon Sep 17 00:00:00 2001 From: --show-origin Date: Fri, 26 Jul 2024 04:56:25 -0700 Subject: [PATCH 2/2] chore: added missing license information in code artifacts --- CHANGELOG.md | 2 +- .../erpadapter/ErpAdapterConfiguration.java | 19 +++++++++++ .../repository/ProductionRepository.java | 24 ++++++++++++-- .../logic/service/ProductionService.java | 33 ++++++++++++++----- charts/puris/templates/_helpers.tpl | 20 +++++++++++ .../templates/backend-secrets-postgres.yaml | 20 +++++++++++ charts/puris/templates/backend-secrets.yaml | 20 +++++++++++ frontend/index.html | 20 +++++++++++ frontend/src/vite-env.d.ts | 19 +++++++++++ frontend/vite.config.ts | 20 +++++++++++ 10 files changed, 185 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bbf38ec..702055c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ CI Chore -* Updated license information ([#468](https://github.com/eclipse-tractusx/puris/pull/468), [#476](https://github.com/eclipse-tractusx/puris/pull/476)) +* Updated license information ([#468](https://github.com/eclipse-tractusx/puris/pull/468), [#476](https://github.com/eclipse-tractusx/puris/pull/476), [#527](https://github.com/eclipse-tractusx/puris/pull/527)) * Update of swagger documentation ([#514](https://github.com/eclipse-tractusx/puris/pull/514), [#516](https://github.com/eclipse-tractusx/puris/pull/516)) * Version Bumps * Infrastructure Components diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/erpadapter/ErpAdapterConfiguration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/erpadapter/ErpAdapterConfiguration.java index fd99682c..88981664 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/erpadapter/ErpAdapterConfiguration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/erpadapter/ErpAdapterConfiguration.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. (represented by Fraunhofer ISST) + * Copyright (c) 2024 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 + */ package org.eclipse.tractusx.puris.backend.erpadapter; import lombok.AccessLevel; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/domain/repository/ProductionRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/domain/repository/ProductionRepository.java index 161eb58e..fd44fd6f 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/domain/repository/ProductionRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/domain/repository/ProductionRepository.java @@ -1,10 +1,30 @@ -package org.eclipse.tractusx.puris.backend.production.domain.repository; +/* + * Copyright (c) 2024 Volkswagen AG + * Copyright (c) 2024 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 + */ -import java.util.UUID; +package org.eclipse.tractusx.puris.backend.production.domain.repository; import org.eclipse.tractusx.puris.backend.production.domain.model.Production; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.UUID; + public interface ProductionRepository extends JpaRepository { } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/logic/service/ProductionService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/logic/service/ProductionService.java index bbfd2765..d8bd42c2 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/logic/service/ProductionService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/production/logic/service/ProductionService.java @@ -1,20 +1,35 @@ +/* + * Copyright (c) 2024 Volkswagen AG + * Copyright (c) 2024 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 + */ package org.eclipse.tractusx.puris.backend.production.logic.service; +import org.eclipse.tractusx.puris.backend.production.domain.model.Production; +import org.eclipse.tractusx.puris.backend.production.domain.repository.ProductionRepository; +import org.springframework.beans.factory.annotation.Autowired; + import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; +import java.util.*; import java.util.stream.Stream; -import org.eclipse.tractusx.puris.backend.production.domain.model.Production; -import org.eclipse.tractusx.puris.backend.production.domain.repository.ProductionRepository; -import org.springframework.beans.factory.annotation.Autowired; - public abstract class ProductionService { @Autowired protected ProductionRepository repository; diff --git a/charts/puris/templates/_helpers.tpl b/charts/puris/templates/_helpers.tpl index b08ed386..946d8f16 100644 --- a/charts/puris/templates/_helpers.tpl +++ b/charts/puris/templates/_helpers.tpl @@ -1,3 +1,23 @@ +{{- /* +* Copyright (c) 2022,2024 Volkswagen AG +* Copyright (c) 2022,2024 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. (represented by Fraunhofer ISST) +* Copyright (c) 2022,2024 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 +*/}} {{/* Expand the name of the chart. */}} diff --git a/charts/puris/templates/backend-secrets-postgres.yaml b/charts/puris/templates/backend-secrets-postgres.yaml index 810a9d60..85631751 100644 --- a/charts/puris/templates/backend-secrets-postgres.yaml +++ b/charts/puris/templates/backend-secrets-postgres.yaml @@ -1,3 +1,23 @@ +{{- /* +* Copyright (c) 2024 Volkswagen AG +* Copyright (c) 2024 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.postgresql.enabled -}} apiVersion: v1 kind: Secret diff --git a/charts/puris/templates/backend-secrets.yaml b/charts/puris/templates/backend-secrets.yaml index 1a14df02..f97bc063 100644 --- a/charts/puris/templates/backend-secrets.yaml +++ b/charts/puris/templates/backend-secrets.yaml @@ -1,3 +1,23 @@ +{{- /* +* Copyright (c) 2024 Volkswagen AG +* Copyright (c) 2024 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 +*/}} + apiVersion: v1 kind: Secret metadata: diff --git a/frontend/index.html b/frontend/index.html index a6b228c8..5ccc6c2e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,3 +1,23 @@ + diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts index e058f21f..b0385cf9 100644 --- a/frontend/src/vite-env.d.ts +++ b/frontend/src/vite-env.d.ts @@ -1 +1,20 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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 +*/ import 'vite/client'; diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 3869f571..63abe1b8 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,3 +1,23 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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 +*/ + import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import path from 'path';