From dcb986d4feadbf8df77e43bff8857602fcbb8bdf Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 7 Mar 2024 15:35:19 +0100 Subject: [PATCH 01/13] chore: add simple data backend app with Dockerfile --- simple-data-backend/DEPENDENCIES | 72 ++++++++++++++ simple-data-backend/DOCKER_NOTICE.md | 28 ++++++ simple-data-backend/Dockerfile | 45 +++++++++ simple-data-backend/pom.xml | 93 +++++++++++++++++++ .../BackendDataServiceApplication.java | 32 +++++++ .../BackendDataServiceController.java | 55 +++++++++++ .../BackendDataServiceControllerTest.java | 37 ++++++++ 7 files changed, 362 insertions(+) create mode 100644 simple-data-backend/DEPENDENCIES create mode 100644 simple-data-backend/DOCKER_NOTICE.md create mode 100644 simple-data-backend/Dockerfile create mode 100644 simple-data-backend/pom.xml create mode 100644 simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java create mode 100644 simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java create mode 100644 simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java diff --git a/simple-data-backend/DEPENDENCIES b/simple-data-backend/DEPENDENCIES new file mode 100644 index 00000000..3c4e07ed --- /dev/null +++ b/simple-data-backend/DEPENDENCIES @@ -0,0 +1,72 @@ +maven/mavencentral/ch.qos.logback/logback-classic/1.4.14, EPL-1.0 OR LGPL-2.1-only, approved, #3435 +maven/mavencentral/ch.qos.logback/logback-core/1.4.14, EPL-1.0 OR LGPL-2.1-only, approved, #3373 +maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.4, Apache-2.0, approved, #7947 +maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.4, MIT AND Apache-2.0, approved, #7932 +maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.4, Apache-2.0, approved, #7934 +maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.4, Apache-2.0, approved, #8808 +maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.4, Apache-2.0, approved, #7930 +maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.4, Apache-2.0, approved, #8803 +maven/mavencentral/com.jayway.jsonpath/json-path/2.9.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 +maven/mavencentral/io.micrometer/micrometer-commons/1.12.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679 +maven/mavencentral/io.micrometer/micrometer-observation/1.12.3, Apache-2.0, approved, #11680 +maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf +maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca +maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.12, Apache-2.0, approved, #7164 +maven/mavencentral/net.bytebuddy/byte-buddy/1.14.12, Apache-2.0 AND BSD-3-Clause, approved, #7163 +maven/mavencentral/net.javacrumbs.json-unit/json-unit-assertj/2.36.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/net.javacrumbs.json-unit/json-unit-core/2.36.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/net.javacrumbs.json-unit/json-unit-json-path/2.36.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/net.minidev/accessors-smart/2.5.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/net.minidev/json-smart/2.5.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.logging.log4j/log4j-api/2.21.1, Apache-2.0 AND (Apache-2.0 AND LGPL-2.0-or-later), approved, #11079 +maven/mavencentral/org.apache.logging.log4j/log4j-core/2.21.1, Apache-2.0 AND (Apache-2.0 AND LGPL-2.0-or-later), approved, #12592 +maven/mavencentral/org.apache.logging.log4j/log4j-jul/2.21.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.logging.log4j/log4j-slf4j2-impl/2.21.1, Apache-2.0, restricted, clearlydefined +maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.21.1, Apache-2.0, approved, #11919 +maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.19, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 +maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.19, Apache-2.0, approved, #6997 +maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.19, Apache-2.0, approved, #7920 +maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 +maven/mavencentral/org.awaitility/awaitility/4.2.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.hamcrest/hamcrest-core/2.2, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.2, EPL-2.0, approved, #9714 +maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.10.2, EPL-2.0, approved, #9711 +maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.10.2, EPL-2.0, approved, #9708 +maven/mavencentral/org.junit.jupiter/junit-jupiter/5.10.2, EPL-2.0, approved, #13393 +maven/mavencentral/org.junit.platform/junit-platform-commons/1.10.2, EPL-2.0, approved, #9715 +maven/mavencentral/org.junit.platform/junit-platform-engine/1.10.2, EPL-2.0, approved, #9709 +maven/mavencentral/org.mockito/mockito-core/5.7.0, MIT AND (Apache-2.0 AND MIT) AND Apache-2.0, approved, #11424 +maven/mavencentral/org.mockito/mockito-junit-jupiter/5.7.0, MIT, approved, #11423 +maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.opentest4j/opentest4j/1.3.0, Apache-2.0, approved, #9713 +maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.12, MIT, approved, #7698 +maven/mavencentral/org.slf4j/slf4j-api/2.0.12, MIT, approved, #5915 +maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.3, Apache-2.0, approved, #11751 +maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.3, Apache-2.0, approved, #11894 +maven/mavencentral/org.springframework.boot/spring-boot-starter-log4j2/3.2.3, , restricted, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.3, Apache-2.0, approved, #11890 +maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.2.3, Apache-2.0, approved, #12917 +maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.2.3, Apache-2.0, approved, #11923 +maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.2.3, Apache-2.0, approved, #11916 +maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.3, Apache-2.0, approved, #11935 +maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.2.3, Apache-2.0, approved, #12920 +maven/mavencentral/org.springframework.boot/spring-boot-test/3.2.3, Apache-2.0, approved, #12916 +maven/mavencentral/org.springframework.boot/spring-boot/3.2.3, Apache-2.0, approved, #11752 +maven/mavencentral/org.springframework/spring-aop/6.1.4, Apache-2.0, approved, #11755 +maven/mavencentral/org.springframework/spring-beans/6.1.4, Apache-2.0, approved, #11754 +maven/mavencentral/org.springframework/spring-context/6.1.4, Apache-2.0, approved, #11753 +maven/mavencentral/org.springframework/spring-core/6.1.4, Apache-2.0 AND BSD-3-Clause, approved, #11750 +maven/mavencentral/org.springframework/spring-expression/6.1.4, Apache-2.0, approved, #11747 +maven/mavencentral/org.springframework/spring-jcl/6.1.4, Apache-2.0, approved, #11749 +maven/mavencentral/org.springframework/spring-test/6.1.4, Apache-2.0, approved, #12919 +maven/mavencentral/org.springframework/spring-web/6.1.4, Apache-2.0, approved, #11748 +maven/mavencentral/org.springframework/spring-webmvc/6.1.4, Apache-2.0, approved, #11879 +maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 +maven/mavencentral/org.yaml/snakeyaml/2.2, Apache-2.0 AND (Apache-2.0 OR BSD-3-Clause OR EPL-1.0 OR GPL-2.0-or-later OR LGPL-2.1-or-later), approved, #10232 diff --git a/simple-data-backend/DOCKER_NOTICE.md b/simple-data-backend/DOCKER_NOTICE.md new file mode 100644 index 00000000..99972b6f --- /dev/null +++ b/simple-data-backend/DOCKER_NOTICE.md @@ -0,0 +1,28 @@ +## Notice for Docker image + +This application provides container images for demonstration purposes. + +DockerHub: https://hub.docker.com/r/tractusx/simple-data-backend + +Eclipse Tractus-X product(s) installed within the image: + +Simple Data Backend + +- GitHub: https://github.com/eclipse-tractusx/tractus-x-umbrella +- Project home: https://projects.eclipse.org/projects/automotive.tractusx +- Dockerfile: https://github.com/eclipse-tractusx/tractus-x-umbrella/blob/main/simple-data-backend/Dockerfile +- Project license: [Apache License, Version 2.0](https://github.com/eclipse-tractusx/tractus-x-umbrella/blob/main/LICENSE) + +**Used base image** + +- [eclipse-temurin:17-jre-alpine](https://github.com/adoptium/containers) +- Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin +- Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin +- Additional information about the Eclipse Temurin + images: https://github.com/docker-library/repo-info/tree/master/repos/eclipse-temurin + +As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc +from the base distribution, along with any direct or indirect dependencies of the primary software being contained). + +As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies +with any relevant licenses for all software contained within. \ No newline at end of file diff --git a/simple-data-backend/Dockerfile b/simple-data-backend/Dockerfile new file mode 100644 index 00000000..ff83e687 --- /dev/null +++ b/simple-data-backend/Dockerfile @@ -0,0 +1,45 @@ +# Copyright (c) 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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 + +# Dependencies +FROM maven:3-eclipse-temurin-17-alpine AS maven +ARG BUILD_TARGET=simple-data-backend + +WORKDIR /build + +COPY . . + +# the --mount option requires BuildKit. +RUN --mount=type=cache,target=/root/.m2 mvn -B clean package -am -DskipTests + + +# Copy the jar and build image +FROM eclipse-temurin:17-jre-alpine AS simple-data-backend + +ARG UID=10000 +ARG GID=3000 + +WORKDIR /app + +COPY --chmod=755 --from=maven /build/target/simple-data-backend*.jar app.jar + +USER ${UID}:${GID} + +ENTRYPOINT ["java", "-jar", "app.jar"] + +HEALTHCHECK --interval=5m --timeout=3s \ + CMD curl -f http://localhost:4004/actuator/health || exit 1 diff --git a/simple-data-backend/pom.xml b/simple-data-backend/pom.xml new file mode 100644 index 00000000..1c0a267f --- /dev/null +++ b/simple-data-backend/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + + + org.eclipse.tractusx.irs + simple-data-backend + 0.0.1-SNAPSHOT + + simple-data-backend + A simple web app to store and load data in memory. + + + 17 + 1.1.0 + 2.36.1 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.projectlombok + lombok + true + + + + org.springframework.boot + spring-boot-starter-test + test + + + net.javacrumbs.json-unit + json-unit-assertj + ${json-unit-assertj.version} + test + + + + + + dash-licenses-releases + https://repo.eclipse.org/content/repositories/dash-licenses-releases/ + + false + + + + + + + + + org.eclipse.dash + license-tool-plugin + ${license-tool-plugin.version} + + automotive.tractusx + test + + + + license-check + + license-check + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java b/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java new file mode 100644 index 00000000..ca58d1fa --- /dev/null +++ b/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2021,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.irs.backenddataservice; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BackendDataServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(BackendDataServiceApplication.class, args); + } + +} diff --git a/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java b/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java new file mode 100644 index 00000000..190d1cc5 --- /dev/null +++ b/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java @@ -0,0 +1,55 @@ +/******************************************************************************** + * Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2021,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.irs.backenddataservice; + +import java.util.HashMap; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.ResponseStatusException; + +@RestController +@RequestMapping +@Slf4j +public class BackendDataServiceController { + private final HashMap data = new HashMap<>(); + + @PostMapping("/{id}") + public void addData(@PathVariable final String id, @RequestBody final Object payload) { + log.info("Adding data for id '{}'", id); + data.put(id, payload); + } + + @GetMapping("/{id}") + public Object getData(@PathVariable final String id) { + if (data.containsKey(id)) { + log.info("Returning data for id '{}'", id); + return data.get(id); + } else { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No data found with id '%s'".formatted(id)); + } + } +} diff --git a/simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java b/simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java new file mode 100644 index 00000000..8246cabd --- /dev/null +++ b/simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java @@ -0,0 +1,37 @@ +package org.eclipse.tractusx.irs.backenddataservice; + +import org.junit.jupiter.api.Test; +import org.springframework.web.server.ResponseStatusException; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +class BackendDataServiceControllerTest { + + @Test + void shouldStoreData() { + // Arrange + final BackendDataServiceController backendDataServiceController = new BackendDataServiceController(); + final String payload = """ + { + "test": "data" + } + """; + + // Act + backendDataServiceController.addData("test", payload); + + // Assert + final Object actualResponse = backendDataServiceController.getData("test"); + assertThat(actualResponse).isEqualTo(payload); + } + + @Test + void shouldThrowNotFoundException() { + // Arrange + final BackendDataServiceController backendDataServiceController = new BackendDataServiceController(); + + // Act & Assert + assertThatExceptionOfType(ResponseStatusException.class).isThrownBy(() -> backendDataServiceController.getData("test")); + } +} \ No newline at end of file From c2deeadbb251138d7c269b6da61a427decfb7c9d Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 7 Mar 2024 15:43:55 +0100 Subject: [PATCH 02/13] chore: add simple data backend helm chart --- charts/simple-data-backend/.helmignore | 47 ++++++++ charts/simple-data-backend/Chart.yaml | 44 +++++++ .../simple-data-backend/templates/NOTES.txt | 22 ++++ .../templates/_helpers.tpl | 73 ++++++++++++ .../templates/deployment.yaml | 77 +++++++++++++ charts/simple-data-backend/templates/hpa.yaml | 48 ++++++++ .../templates/ingress.yaml | 82 ++++++++++++++ .../templates/service.yaml | 35 ++++++ .../templates/tests/test-connection.yaml | 35 ++++++ charts/simple-data-backend/values.yaml | 107 ++++++++++++++++++ 10 files changed, 570 insertions(+) create mode 100644 charts/simple-data-backend/.helmignore create mode 100644 charts/simple-data-backend/Chart.yaml create mode 100644 charts/simple-data-backend/templates/NOTES.txt create mode 100644 charts/simple-data-backend/templates/_helpers.tpl create mode 100644 charts/simple-data-backend/templates/deployment.yaml create mode 100644 charts/simple-data-backend/templates/hpa.yaml create mode 100644 charts/simple-data-backend/templates/ingress.yaml create mode 100644 charts/simple-data-backend/templates/service.yaml create mode 100644 charts/simple-data-backend/templates/tests/test-connection.yaml create mode 100644 charts/simple-data-backend/values.yaml diff --git a/charts/simple-data-backend/.helmignore b/charts/simple-data-backend/.helmignore new file mode 100644 index 00000000..c89dfd08 --- /dev/null +++ b/charts/simple-data-backend/.helmignore @@ -0,0 +1,47 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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 +# ############################################################################# + +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ + +# Ignore ENV specific values at release +values?*.yaml +values?*.yml diff --git a/charts/simple-data-backend/Chart.yaml b/charts/simple-data-backend/Chart.yaml new file mode 100644 index 00000000..d077a1e9 --- /dev/null +++ b/charts/simple-data-backend/Chart.yaml @@ -0,0 +1,44 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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: v2 +name: simple-data-backend +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.0.1" diff --git a/charts/simple-data-backend/templates/NOTES.txt b/charts/simple-data-backend/templates/NOTES.txt new file mode 100644 index 00000000..14052a42 --- /dev/null +++ b/charts/simple-data-backend/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "simple-data-backend.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "simple-data-backend.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "simple-data-backend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "simple-data-backend.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/simple-data-backend/templates/_helpers.tpl b/charts/simple-data-backend/templates/_helpers.tpl new file mode 100644 index 00000000..ffc1b7b1 --- /dev/null +++ b/charts/simple-data-backend/templates/_helpers.tpl @@ -0,0 +1,73 @@ +{{/* +******************************************************************************* + * Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2021,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. +*/}} +{{- define "simple-data-backend.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "simple-data-backend.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "simple-data-backend.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "simple-data-backend.labels" -}} +helm.sh/chart: {{ include "simple-data-backend.chart" . }} +{{ include "simple-data-backend.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "simple-data-backend.selectorLabels" -}} +app.kubernetes.io/name: {{ include "simple-data-backend.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + diff --git a/charts/simple-data-backend/templates/deployment.yaml b/charts/simple-data-backend/templates/deployment.yaml new file mode 100644 index 00000000..113bf25a --- /dev/null +++ b/charts/simple-data-backend/templates/deployment.yaml @@ -0,0 +1,77 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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: apps/v1 +kind: Deployment +metadata: + name: {{ include "simple-data-backend.fullname" . }} + labels: + {{- include "simple-data-backend.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "simple-data-backend.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "simple-data-backend.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + # @url: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server + automountServiceAccountToken: false + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: default + containerPort: {{ .Values.backend.endpoint.default.port }} + protocol: TCP + - name: metrics + containerPort: 8090 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/simple-data-backend/templates/hpa.yaml b/charts/simple-data-backend/templates/hpa.yaml new file mode 100644 index 00000000..4ee527e7 --- /dev/null +++ b/charts/simple-data-backend/templates/hpa.yaml @@ -0,0 +1,48 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "simple-data-backend.fullname" . }} + labels: + {{- include "simple-data-backend.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "simple-data-backend.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/simple-data-backend/templates/ingress.yaml b/charts/simple-data-backend/templates/ingress.yaml new file mode 100644 index 00000000..95060b97 --- /dev/null +++ b/charts/simple-data-backend/templates/ingress.yaml @@ -0,0 +1,82 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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.ingress.enabled -}} +{{- $fullName := include "simple-data-backend.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "simple-data-backend.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/simple-data-backend/templates/service.yaml b/charts/simple-data-backend/templates/service.yaml new file mode 100644 index 00000000..40edd4d6 --- /dev/null +++ b/charts/simple-data-backend/templates/service.yaml @@ -0,0 +1,35 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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: Service +metadata: + name: {{ include "simple-data-backend.fullname" . }} + labels: + {{- include "simple-data-backend.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: default + protocol: TCP + name: http + selector: + {{- include "simple-data-backend.selectorLabels" . | nindent 4 }} diff --git a/charts/simple-data-backend/templates/tests/test-connection.yaml b/charts/simple-data-backend/templates/tests/test-connection.yaml new file mode 100644 index 00000000..8bc33d5a --- /dev/null +++ b/charts/simple-data-backend/templates/tests/test-connection.yaml @@ -0,0 +1,35 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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: Pod +metadata: + name: "{{ include "simple-data-backend.fullname" . }}-test-connection" + labels: + {{- include "simple-data-backend.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "simple-data-backend.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/simple-data-backend/values.yaml b/charts/simple-data-backend/values.yaml new file mode 100644 index 00000000..db804333 --- /dev/null +++ b/charts/simple-data-backend/values.yaml @@ -0,0 +1,107 @@ +# ############################################################################# +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021,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 +# ############################################################################# + +# Default values for simple-data-backend. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +nameOverride: +fullnameOverride: + +image: + repository: tractusx/simple-data-backend + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] + +podAnnotations: {} + +podSecurityContext: {} +# fsGroup: 2000 + +# @url: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 3000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + +# @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits +resources: + limits: + cpu: 250m + memory: 512Mi + requests: + cpu: 50m + memory: 512Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +# @url: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: DoesNotExist + topologyKey: kubernetes.io/hostname + +livenessProbe: + failureThreshold: 6 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 +readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + +backend: + endpoint: + default: + port: 8080 + path: / + ingress: true From d2c0c6d35b5cda935e61ae96096118b6b4164ef9 Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 7 Mar 2024 15:44:36 +0100 Subject: [PATCH 03/13] chore: add ignore for *.iml and target/ --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f8bc993f..7b228950 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .idea/ **/*.tgz Chart.lock +*.iml +target/ \ No newline at end of file From d4e1f243e44fe61a88a30ec14a27dc53220ba11d Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 7 Mar 2024 16:14:57 +0100 Subject: [PATCH 04/13] chore: add workflows to build, check and publish the docker image --- .github/workflows/build-docker-image.yaml | 76 +++++++++++++++++++++++ .github/workflows/eclipse-dash.yml | 45 ++++++++++++++ .github/workflows/java-ci.yml | 42 +++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 .github/workflows/build-docker-image.yaml create mode 100644 .github/workflows/eclipse-dash.yml create mode 100644 .github/workflows/java-ci.yml diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml new file mode 100644 index 00000000..3840f608 --- /dev/null +++ b/.github/workflows/build-docker-image.yaml @@ -0,0 +1,76 @@ +name: Build - Docker image + +on: + push: + branches: + - main + paths: + - 'simple-data-backend/**' + # trigger events for SemVer like tags + tags: + - '*.*.*' + - '*.*.*-*' + pull_request: + branches: + - main + paths: + - 'simple-data-backend/**' + +env: + IMAGE_NAMESPACE: "tractusx" + IMAGE_NAME: "simple-data-backend" + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Create SemVer or ref tags dependent of trigger event + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }} + # Automatically prepare image tags; See action docs for more examples. + # semver patter will generate tags like these for example :1 :1.2 :1.2.3 + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + + - name: DockerHub login + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + # Use existing DockerHub credentials present as secrets + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: simple-data-backend/ + # Build image for verification purposes on every trigger event. Only push if event is not a PR + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + # https://github.com/peter-evans/dockerhub-description + # Important step to push image description to DockerHub + - name: Update Docker Hub description + if: github.event_name != 'pull_request' + uses: peter-evans/dockerhub-description@v4 + with: + # readme-filepath defaults to toplevel README.md, Only necessary if you have a dedicated file with your 'Notice for docker images' + readme-filepath: ./simple-data-backend/DOCKER_NOTICE.md + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }} \ No newline at end of file diff --git a/.github/workflows/eclipse-dash.yml b/.github/workflows/eclipse-dash.yml new file mode 100644 index 00000000..fe587f8a --- /dev/null +++ b/.github/workflows/eclipse-dash.yml @@ -0,0 +1,45 @@ +name: "Eclipse DASH IP Check" + +on: + push: + branches: + - main + paths-ignore: + - '**/*.md' + - '**/*.txt' + pull_request: + branches: + - main + paths: + - '**/pom.xml' + - 'pom.xml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Cache maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build with Maven and check dependencies with dash + working-directory: simple-data-backend/ + run: | + mvn --batch-mode verify -Ddash.fail=true -DskipTests + + - name: Ensure DEPENDENCIES file is reflecting the current state + working-directory: simple-data-backend/ + run: | + mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES-gen + diff DEPENDENCIES DEPENDENCIES-gen diff --git a/.github/workflows/java-ci.yml b/.github/workflows/java-ci.yml new file mode 100644 index 00000000..4ec832c7 --- /dev/null +++ b/.github/workflows/java-ci.yml @@ -0,0 +1,42 @@ +name: Java CI with Maven + +on: + push: + branches: + - main + paths: + - 'simple-data-backend/**' + # trigger events for SemVer like tags + tags: + - '*.*.*' + - '*.*.*-*' + pull_request: + branches: + - main + paths: + - 'simple-data-backend/**' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Cache maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build with Maven + working-directory: simple-data-backend/ + run: | + mvn clean verify --batch-mode From 668ec0980739ecf805ca04f157b8940279f1d32a Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 7 Mar 2024 16:19:25 +0100 Subject: [PATCH 05/13] chore: add simple data backend app with Dockerfile --- .../SimpleDataServiceApplication.java} | 6 +++--- .../SimpleDataServiceController.java} | 4 ++-- .../SimpleDataServiceControllerTest.java} | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) rename simple-data-backend/src/main/java/org/eclipse/tractusx/{irs/backenddataservice/BackendDataServiceApplication.java => simpledataservice/SimpleDataServiceApplication.java} (87%) rename simple-data-backend/src/main/java/org/eclipse/tractusx/{irs/backenddataservice/BackendDataServiceController.java => simpledataservice/SimpleDataServiceController.java} (95%) rename simple-data-backend/src/test/java/org/eclipse/tractusx/{irs/backenddataservice/BackendDataServiceControllerTest.java => simpledataservice/SimpleDataServiceControllerTest.java} (56%) diff --git a/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java b/simple-data-backend/src/main/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceApplication.java similarity index 87% rename from simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java rename to simple-data-backend/src/main/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceApplication.java index ca58d1fa..352253f1 100644 --- a/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceApplication.java +++ b/simple-data-backend/src/main/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceApplication.java @@ -17,16 +17,16 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.irs.backenddataservice; +package org.eclipse.tractusx.simpledataservice; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class BackendDataServiceApplication { +public class SimpleDataServiceApplication { public static void main(String[] args) { - SpringApplication.run(BackendDataServiceApplication.class, args); + SpringApplication.run(SimpleDataServiceApplication.class, args); } } diff --git a/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java b/simple-data-backend/src/main/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceController.java similarity index 95% rename from simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java rename to simple-data-backend/src/main/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceController.java index 190d1cc5..0f151846 100644 --- a/simple-data-backend/src/main/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceController.java +++ b/simple-data-backend/src/main/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceController.java @@ -17,7 +17,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.irs.backenddataservice; +package org.eclipse.tractusx.simpledataservice; import java.util.HashMap; @@ -34,7 +34,7 @@ @RestController @RequestMapping @Slf4j -public class BackendDataServiceController { +public class SimpleDataServiceController { private final HashMap data = new HashMap<>(); @PostMapping("/{id}") diff --git a/simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java b/simple-data-backend/src/test/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceControllerTest.java similarity index 56% rename from simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java rename to simple-data-backend/src/test/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceControllerTest.java index 8246cabd..0fb1ca1f 100644 --- a/simple-data-backend/src/test/java/org/eclipse/tractusx/irs/backenddataservice/BackendDataServiceControllerTest.java +++ b/simple-data-backend/src/test/java/org/eclipse/tractusx/simpledataservice/SimpleDataServiceControllerTest.java @@ -1,4 +1,4 @@ -package org.eclipse.tractusx.irs.backenddataservice; +package org.eclipse.tractusx.simpledataservice; import org.junit.jupiter.api.Test; import org.springframework.web.server.ResponseStatusException; @@ -6,12 +6,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -class BackendDataServiceControllerTest { +class SimpleDataServiceControllerTest { @Test void shouldStoreData() { // Arrange - final BackendDataServiceController backendDataServiceController = new BackendDataServiceController(); + final SimpleDataServiceController simpleDataServiceController = new SimpleDataServiceController(); final String payload = """ { "test": "data" @@ -19,19 +19,19 @@ void shouldStoreData() { """; // Act - backendDataServiceController.addData("test", payload); + simpleDataServiceController.addData("test", payload); // Assert - final Object actualResponse = backendDataServiceController.getData("test"); + final Object actualResponse = simpleDataServiceController.getData("test"); assertThat(actualResponse).isEqualTo(payload); } @Test void shouldThrowNotFoundException() { // Arrange - final BackendDataServiceController backendDataServiceController = new BackendDataServiceController(); + final SimpleDataServiceController simpleDataServiceController = new SimpleDataServiceController(); // Act & Assert - assertThatExceptionOfType(ResponseStatusException.class).isThrownBy(() -> backendDataServiceController.getData("test")); + assertThatExceptionOfType(ResponseStatusException.class).isThrownBy(() -> simpleDataServiceController.getData("test")); } } \ No newline at end of file From ebef0fbf841af8c442e0cbe78d8f73e52638f4ac Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Fri, 15 Mar 2024 13:32:44 +0100 Subject: [PATCH 06/13] chore: remove unused endpoint configuration --- charts/simple-data-backend/templates/deployment.yaml | 5 +---- charts/simple-data-backend/values.yaml | 7 ------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/charts/simple-data-backend/templates/deployment.yaml b/charts/simple-data-backend/templates/deployment.yaml index 113bf25a..5da1359d 100644 --- a/charts/simple-data-backend/templates/deployment.yaml +++ b/charts/simple-data-backend/templates/deployment.yaml @@ -56,11 +56,8 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: default - containerPort: {{ .Values.backend.endpoint.default.port }} + containerPort: {{ .Values.service.port }} protocol: TCP - - name: metrics - containerPort: 8090 - protocol: TCP resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/charts/simple-data-backend/values.yaml b/charts/simple-data-backend/values.yaml index db804333..e12f51fa 100644 --- a/charts/simple-data-backend/values.yaml +++ b/charts/simple-data-backend/values.yaml @@ -98,10 +98,3 @@ readinessProbe: periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 - -backend: - endpoint: - default: - port: 8080 - path: / - ingress: true From 993160bb98b2c1bc4678cd206b3a747352fbd70b Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Fri, 15 Mar 2024 13:39:57 +0100 Subject: [PATCH 07/13] chore: add application.yaml --- simple-data-backend/src/main/resources/application.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 simple-data-backend/src/main/resources/application.yaml diff --git a/simple-data-backend/src/main/resources/application.yaml b/simple-data-backend/src/main/resources/application.yaml new file mode 100644 index 00000000..4551e4c8 --- /dev/null +++ b/simple-data-backend/src/main/resources/application.yaml @@ -0,0 +1,6 @@ +server: + port: 8080 + +spring: + application: + name: simple-data-backend \ No newline at end of file From 50b2fea6978871ca7f8afe6a0b9528398557465b Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Mon, 18 Mar 2024 18:09:16 +0100 Subject: [PATCH 08/13] chore: fix liveness- and readinessProbe template and added missing actuator --- .../templates/deployment.yaml | 21 +++++++++++++++++++ simple-data-backend/DEPENDENCIES | 7 +++++++ simple-data-backend/Dockerfile | 3 --- simple-data-backend/pom.xml | 4 ++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/charts/simple-data-backend/templates/deployment.yaml b/charts/simple-data-backend/templates/deployment.yaml index 5da1359d..0e6d7525 100644 --- a/charts/simple-data-backend/templates/deployment.yaml +++ b/charts/simple-data-backend/templates/deployment.yaml @@ -58,6 +58,27 @@ spec: - name: default containerPort: {{ .Values.service.port }} protocol: TCP + # @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-setting-up-health-checks-with-readiness-and-liveness-probes + livenessProbe: + httpGet: + path: "/actuator/health/liveness" + port: default + scheme: HTTP + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: "/actuator/health/readiness" + port: default + scheme: HTTP + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/simple-data-backend/DEPENDENCIES b/simple-data-backend/DEPENDENCIES index 3c4e07ed..6ee99ddc 100644 --- a/simple-data-backend/DEPENDENCIES +++ b/simple-data-backend/DEPENDENCIES @@ -9,6 +9,8 @@ maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2 maven/mavencentral/com.jayway.jsonpath/json-path/2.9.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/io.micrometer/micrometer-commons/1.12.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679 +maven/mavencentral/io.micrometer/micrometer-core/1.12.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11678 +maven/mavencentral/io.micrometer/micrometer-jakarta9/1.12.3, Apache-2.0, approved, #12923 maven/mavencentral/io.micrometer/micrometer-observation/1.12.3, Apache-2.0, approved, #11680 maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca @@ -33,12 +35,14 @@ maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 maven/mavencentral/org.awaitility/awaitility/4.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.hamcrest/hamcrest-core/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/org.hdrhistogram/HdrHistogram/2.1.12, BSD-2-Clause OR LicenseRef-Public-Domain, approved, CQ13192 maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.2, EPL-2.0, approved, #9714 maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.10.2, EPL-2.0, approved, #9711 maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.10.2, EPL-2.0, approved, #9708 maven/mavencentral/org.junit.jupiter/junit-jupiter/5.10.2, EPL-2.0, approved, #13393 maven/mavencentral/org.junit.platform/junit-platform-commons/1.10.2, EPL-2.0, approved, #9715 maven/mavencentral/org.junit.platform/junit-platform-engine/1.10.2, EPL-2.0, approved, #9709 +maven/mavencentral/org.latencyutils/LatencyUtils/2.0.3, BSD-2-Clause, approved, CQ17408 maven/mavencentral/org.mockito/mockito-core/5.7.0, MIT AND (Apache-2.0 AND MIT) AND Apache-2.0, approved, #11424 maven/mavencentral/org.mockito/mockito-junit-jupiter/5.7.0, MIT, approved, #11423 maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydefined @@ -48,7 +52,10 @@ maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-D maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.12, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.12, MIT, approved, #5915 +maven/mavencentral/org.springframework.boot/spring-boot-actuator-autoconfigure/3.2.3, Apache-2.0, approved, #11921 +maven/mavencentral/org.springframework.boot/spring-boot-actuator/3.2.3, Apache-2.0, approved, #11918 maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.3, Apache-2.0, approved, #11751 +maven/mavencentral/org.springframework.boot/spring-boot-starter-actuator/3.2.3, Apache-2.0, approved, #12918 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.3, Apache-2.0, approved, #11894 maven/mavencentral/org.springframework.boot/spring-boot-starter-log4j2/3.2.3, , restricted, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.3, Apache-2.0, approved, #11890 diff --git a/simple-data-backend/Dockerfile b/simple-data-backend/Dockerfile index ff83e687..144c0d70 100644 --- a/simple-data-backend/Dockerfile +++ b/simple-data-backend/Dockerfile @@ -40,6 +40,3 @@ COPY --chmod=755 --from=maven /build/target/simple-data-backend*.jar app.jar USER ${UID}:${GID} ENTRYPOINT ["java", "-jar", "app.jar"] - -HEALTHCHECK --interval=5m --timeout=3s \ - CMD curl -f http://localhost:4004/actuator/health || exit 1 diff --git a/simple-data-backend/pom.xml b/simple-data-backend/pom.xml index 1c0a267f..4f125ed5 100644 --- a/simple-data-backend/pom.xml +++ b/simple-data-backend/pom.xml @@ -32,6 +32,10 @@ org.springframework.boot spring-boot-starter-log4j2 + + org.springframework.boot + spring-boot-starter-actuator + org.projectlombok lombok From 7b9e86033cb9c3a89f5339fc2faba7fd588193a0 Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Fri, 22 Mar 2024 11:35:40 +0100 Subject: [PATCH 09/13] chore: switch to java 21 and jdk 21 --- .github/workflows/eclipse-dash.yml | 4 ++-- .github/workflows/java-ci.yml | 4 ++-- simple-data-backend/DOCKER_NOTICE.md | 2 +- simple-data-backend/Dockerfile | 4 ++-- simple-data-backend/pom.xml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/eclipse-dash.yml b/.github/workflows/eclipse-dash.yml index fe587f8a..af800415 100644 --- a/.github/workflows/eclipse-dash.yml +++ b/.github/workflows/eclipse-dash.yml @@ -20,10 +20,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Cache maven packages diff --git a/.github/workflows/java-ci.yml b/.github/workflows/java-ci.yml index 4ec832c7..8c17c7b6 100644 --- a/.github/workflows/java-ci.yml +++ b/.github/workflows/java-ci.yml @@ -23,10 +23,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Cache maven packages diff --git a/simple-data-backend/DOCKER_NOTICE.md b/simple-data-backend/DOCKER_NOTICE.md index 99972b6f..b44a4e1a 100644 --- a/simple-data-backend/DOCKER_NOTICE.md +++ b/simple-data-backend/DOCKER_NOTICE.md @@ -15,7 +15,7 @@ Simple Data Backend **Used base image** -- [eclipse-temurin:17-jre-alpine](https://github.com/adoptium/containers) +- [eclipse-temurin:21-jre-alpine](https://github.com/adoptium/containers) - Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin - Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin - Additional information about the Eclipse Temurin diff --git a/simple-data-backend/Dockerfile b/simple-data-backend/Dockerfile index 144c0d70..c23d6074 100644 --- a/simple-data-backend/Dockerfile +++ b/simple-data-backend/Dockerfile @@ -16,7 +16,7 @@ # * SPDX-License-Identifier: Apache-2.0 # Dependencies -FROM maven:3-eclipse-temurin-17-alpine AS maven +FROM maven:3-eclipse-temurin-21-alpine AS maven ARG BUILD_TARGET=simple-data-backend WORKDIR /build @@ -28,7 +28,7 @@ RUN --mount=type=cache,target=/root/.m2 mvn -B clean package -am -DskipTests # Copy the jar and build image -FROM eclipse-temurin:17-jre-alpine AS simple-data-backend +FROM eclipse-temurin:21-jre-alpine AS simple-data-backend ARG UID=10000 ARG GID=3000 diff --git a/simple-data-backend/pom.xml b/simple-data-backend/pom.xml index 4f125ed5..6265c643 100644 --- a/simple-data-backend/pom.xml +++ b/simple-data-backend/pom.xml @@ -18,7 +18,7 @@ A simple web app to store and load data in memory. - 17 + 21 1.1.0 2.36.1 From 4b438750a23e045e94280fa84547d5ec2d17f6c8 Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Fri, 22 Mar 2024 11:41:33 +0100 Subject: [PATCH 10/13] chore: add multi plattform build for linux/amd64 and linux/arm64 --- .github/workflows/build-docker-image.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml index 3840f608..a24460a1 100644 --- a/.github/workflows/build-docker-image.yaml +++ b/.github/workflows/build-docker-image.yaml @@ -19,6 +19,7 @@ on: env: IMAGE_NAMESPACE: "tractusx" IMAGE_NAME: "simple-data-backend" + TARGET_PLATFORMS: "linux/amd64, linux/arm64" jobs: docker: @@ -30,6 +31,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + # Needed to create multi-platform image + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # Needed to create multi-platform image + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + # Create SemVer or ref tags dependent of trigger event - name: Docker meta id: meta @@ -58,6 +67,8 @@ jobs: uses: docker/build-push-action@v5 with: context: simple-data-backend/ + # Needed to create multi-platform image + platforms: ${{ env.TARGET_PLATFORMS }} # Build image for verification purposes on every trigger event. Only push if event is not a PR push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} From dc7e56dfa4be7c25c61255a54554f68dd80f1496 Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Thu, 4 Apr 2024 10:56:36 +0200 Subject: [PATCH 11/13] chore(helm-checks): add simple-data-backend (#59) --- .github/workflows/helm-checks.yaml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/helm-checks.yaml b/.github/workflows/helm-checks.yaml index c53c0267..3cf74fc6 100644 --- a/.github/workflows/helm-checks.yaml +++ b/.github/workflows/helm-checks.yaml @@ -88,6 +88,22 @@ jobs: with: fetch-depth: 0 + - name: Kubernetes KinD Cluster + uses: container-tools/kind-action@v2 + 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 + # default value for event_name != workflow_dispatch + node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.27.3' }} + + - name: Build simple data backend + id: build-simple-data-backend + uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 + with: + context: simple-data-backend/ + push: true + tags: kind-registry:5000/simple-data-backend:testing + - name: Set up Helm uses: azure/setup-helm@v3 with: @@ -109,13 +125,10 @@ jobs: shell: bash run: hack/helm-dependencies.bash - - name: Kubernetes KinD Cluster - uses: helm/kind-action@v1.8.0 - with: - # default value for event_name != workflow_dispatch - node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.27.3' }} + - name: Install chart and run tests (simple-data-backend) + run: ct install --charts charts/simple-data-backend --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "--set image.repository=kind-registry:5000/simple-data-backend --set image.tag=testing" - - name: Install chart and run tests + - name: Install chart and run tests (umbrella) run: ct install --charts charts/umbrella --target-branch ${{ github.event.repository.default_branch }} From ccd025c17cf04f07d499681fa31fefb5b354ac2f Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 4 Apr 2024 12:21:43 +0200 Subject: [PATCH 12/13] chore: fix helm test --- charts/simple-data-backend/templates/tests/test-connection.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/simple-data-backend/templates/tests/test-connection.yaml b/charts/simple-data-backend/templates/tests/test-connection.yaml index 8bc33d5a..4e4e620e 100644 --- a/charts/simple-data-backend/templates/tests/test-connection.yaml +++ b/charts/simple-data-backend/templates/tests/test-connection.yaml @@ -31,5 +31,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "simple-data-backend.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "simple-data-backend.fullname" . }}:{{ .Values.service.port }}/actuator/health'] restartPolicy: Never From 46fd6da741ae1f32a1006eedc826872b9f0ca120 Mon Sep 17 00:00:00 2001 From: Jaro Hartmann Date: Thu, 4 Apr 2024 12:22:53 +0200 Subject: [PATCH 13/13] chore: update DEPENDENCIES --- simple-data-backend/DEPENDENCIES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simple-data-backend/DEPENDENCIES b/simple-data-backend/DEPENDENCIES index 6ee99ddc..e726a764 100644 --- a/simple-data-backend/DEPENDENCIES +++ b/simple-data-backend/DEPENDENCIES @@ -32,7 +32,7 @@ maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.19, Apache-2.0, maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.19, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 -maven/mavencentral/org.awaitility/awaitility/4.2.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.awaitility/awaitility/4.2.0, Apache-2.0, approved, #14178 maven/mavencentral/org.hamcrest/hamcrest-core/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hdrhistogram/HdrHistogram/2.1.12, BSD-2-Clause OR LicenseRef-Public-Domain, approved, CQ13192 @@ -57,7 +57,7 @@ maven/mavencentral/org.springframework.boot/spring-boot-actuator/3.2.3, Apache-2 maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.3, Apache-2.0, approved, #11751 maven/mavencentral/org.springframework.boot/spring-boot-starter-actuator/3.2.3, Apache-2.0, approved, #12918 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.3, Apache-2.0, approved, #11894 -maven/mavencentral/org.springframework.boot/spring-boot-starter-log4j2/3.2.3, , restricted, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-log4j2/3.2.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.3, Apache-2.0, approved, #11890 maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.2.3, Apache-2.0, approved, #12917 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.2.3, Apache-2.0, approved, #11923