From 228e16a7af140fef7baf9fba9b97937996377353 Mon Sep 17 00:00:00 2001 From: Roman Seyffarth Date: Fri, 25 Mar 2022 14:56:31 +0100 Subject: [PATCH 1/5] build: fix report service build with JDK 11 --- services/report/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/report/build.gradle.kts b/services/report/build.gradle.kts index d6305825..176eda1b 100644 --- a/services/report/build.gradle.kts +++ b/services/report/build.gradle.kts @@ -5,9 +5,9 @@ plugins { id("com.github.jk1.dependency-license-report") version "1.16" id("org.springframework.boot") version "2.2.5.RELEASE" id("com.diffplug.spotless") version "5.14.3" - kotlin("jvm") version "1.5.30" - kotlin("kapt") version "1.5.30" - kotlin("plugin.spring") version "1.5.30" + kotlin("jvm") version "1.6.10" + kotlin("kapt") version "1.6.10" + kotlin("plugin.spring") version "1.6.10" // we should switch to the plugin but enabling it causes warnings for the openapi generator //id("io.freefair.lombok") version "6.2.0" } From 27164c17e6c8048d0baa9074b32d7af54f65ba67 Mon Sep 17 00:00:00 2001 From: Roman Seyffarth Date: Fri, 25 Mar 2022 14:58:20 +0100 Subject: [PATCH 2/5] test: fix testcontainers-based tests on ARM Spring Boot pins the jna dependency to a version that causes testcontainers to not detect the Docker environment on M1 Macs. We had to override the version to a newer one. --- services/habit/build.gradle | 4 +++- services/track/build.gradle | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/habit/build.gradle b/services/habit/build.gradle index 968a988c..474b691f 100644 --- a/services/habit/build.gradle +++ b/services/habit/build.gradle @@ -66,11 +66,13 @@ ext { springfox : '2.9.2', liquibase : '4.4.3', pactProvider : '3.6.12', - springCloudVersion: 'Greenwich.SR6' + springCloudVersion: 'Greenwich.SR6', + jna : '5.8.0' ] } // override the version the spring boot dependency-management plugin would enforce ext['junit-jupiter.version'] = versions.junitJupiter +ext['jna.version'] = versions.jna // Required for Docker on ARM dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' diff --git a/services/track/build.gradle b/services/track/build.gradle index c4784980..cc27a877 100644 --- a/services/track/build.gradle +++ b/services/track/build.gradle @@ -63,11 +63,13 @@ ext { testcontainers : '1.15.3', reflections : '0.9.12', postgresql : '42.2.23', - springCloudVersion: 'Greenwich.SR6' + springCloudVersion: 'Greenwich.SR6', + jna : '5.8.0' ] } // override the version the spring boot dependency-management plugin would enforce ext['junit-jupiter.version'] = versions.junitJupiter +ext['jna.version'] = versions.jna // Required for Docker on ARM dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' From 22b8dec8ff8bc76646b6cd4d9e74622dec56e9e8 Mon Sep 17 00:00:00 2001 From: Roman Seyffarth Date: Fri, 25 Mar 2022 14:59:39 +0100 Subject: [PATCH 3/5] chore: pick up the correct init image tag in habit and track Helm charts --- services/habit/helm/habit/templates/_helpers.tpl | 2 +- services/track/helm/track/templates/_helpers.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/habit/helm/habit/templates/_helpers.tpl b/services/habit/helm/habit/templates/_helpers.tpl index ba32f856..d403a180 100644 --- a/services/habit/helm/habit/templates/_helpers.tpl +++ b/services/habit/helm/habit/templates/_helpers.tpl @@ -32,7 +32,7 @@ Return the proper habitcentric init image name {{- define "habit.init.image" -}} {{- $registryName := .Values.init.image.registry -}} {{- $repositoryName := .Values.init.image.repository -}} -{{- $tag := .Values.image.tag | toString -}} +{{- $tag := .Values.init.image.tag | toString -}} {{/* Helm 2.11 supports the assignment of a value to a variable defined in a different scope, but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. diff --git a/services/track/helm/track/templates/_helpers.tpl b/services/track/helm/track/templates/_helpers.tpl index f5a50082..503d933f 100644 --- a/services/track/helm/track/templates/_helpers.tpl +++ b/services/track/helm/track/templates/_helpers.tpl @@ -32,7 +32,7 @@ Return the proper habitcentric init image name {{- define "track.init.image" -}} {{- $registryName := .Values.init.image.registry -}} {{- $repositoryName := .Values.init.image.repository -}} -{{- $tag := .Values.image.tag | toString -}} +{{- $tag := .Values.init.image.tag | toString -}} {{/* Helm 2.11 supports the assignment of a value to a variable defined in a different scope, but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. From 40e78463cbdbf256bd37cee222a5c01c4fafc603 Mon Sep 17 00:00:00 2001 From: Roman Seyffarth Date: Fri, 25 Mar 2022 17:09:31 +0100 Subject: [PATCH 4/5] feat: upgrade locust to support ARM builds --- test/lpt-locust/Dockerfile | 2 +- test/lpt-locust/requirements.txt | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/lpt-locust/Dockerfile b/test/lpt-locust/Dockerfile index 55839e0e..00fac898 100644 --- a/test/lpt-locust/Dockerfile +++ b/test/lpt-locust/Dockerfile @@ -1,4 +1,4 @@ -FROM locustio/locust:1.2.3 +FROM locustio/locust:2.8.4 RUN pip3 install kubernetes COPY src /locust-config ENV LOCUST_LOCUSTFILE /locust-config/locustfile.py diff --git a/test/lpt-locust/requirements.txt b/test/lpt-locust/requirements.txt index 252b4806..7ca7b1e6 100644 --- a/test/lpt-locust/requirements.txt +++ b/test/lpt-locust/requirements.txt @@ -6,15 +6,15 @@ click==8.0.4 ConfigArgParse==1.5.3 Flask==2.0.3 Flask-BasicAuth==0.2.0 +Flask-Cors==3.0.10 gevent==21.12.0 geventhttpclient==1.5.3 -google-auth==2.6.0 +google-auth==2.6.2 greenlet==1.1.2 idna==3.3 -itsdangerous==2.1.0 +itsdangerous==2.1.1 Jinja2==3.0.3 -kubernetes==11.0.0 -locust==1.2.3 +kubernetes==23.3.0 MarkupSafe==2.1.0 msgpack==1.0.3 oauthlib==3.2.0 @@ -28,8 +28,10 @@ PyYAML==6.0 pyzmq==22.3.0 requests==2.27.1 requests-oauthlib==1.3.1 +roundrobin==0.0.2 rsa==4.8 six==1.16.0 +typing_extensions==4.1.1 urllib3==1.26.8 websocket-client==1.3.1 Werkzeug==2.0.3 From a9a939df7785e09e5c115a17ed80cb8b0d17212f Mon Sep 17 00:00:00 2001 From: Roman Seyffarth Date: Fri, 25 Mar 2022 17:48:09 +0100 Subject: [PATCH 5/5] ci: build container images for linux/arm64 platform --- .github/workflows/build-docker.yaml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index 2b941e43..2ef8d152 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -7,6 +7,10 @@ on: version: required: true type: string + platforms: + required: false + type: string + default: "linux/amd64,linux/arm64" working-dir: required: true type: string @@ -24,28 +28,32 @@ jobs: steps: - name: ⬇️ Checkout uses: actions/checkout@v2 - - name: Download artifact + - name: 📦 Download artifact uses: actions/download-artifact@v2 if: inputs.artifact-name && inputs.artifact-path with: name: ${{ inputs.artifact-name }} path: ${{ inputs.artifact-path }} + - name: 🦤 Set up qemu + uses: docker/setup-qemu-action@v1 + - name: 🐳 Set up docker buildx + uses: docker/setup-buildx-action@v1 - name: 🧰 Build container image + if: github.ref != 'refs/heads/main' || inputs.version == 'dev' working-directory: ${{ inputs.working-dir }} - run: | - docker build \ - -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \ - -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \ - -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" . + run: docker buildx build --platform "${{ inputs.platforms }}" . - name: 🔑 Login to GitHub Container registry + if: github.ref == 'refs/heads/main' && inputs.version != 'dev' uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: ⬆️ Push container image + - name: 🧰 ⬆️ Build and push container image if: github.ref == 'refs/heads/main' && inputs.version != 'dev' + working-directory: ${{ inputs.working-dir }} run: | - docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" - docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" - docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" + docker buildx build --push --platform "${{ inputs.platforms }}" \ + -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \ + -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \ + -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .