From 1625b336bb0bb4c12ebd548c0c3340bf37cb80f3 Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 13:23:05 +0100 Subject: [PATCH 1/8] LIBRARIES-1490 - Update image to 8.17.3 --- .github/workflows/nightly.yml | 9 +-- .github/workflows/release.yml | 22 ++++--- .github/workflows/review.yml | 60 +++++++++++-------- README.md | 4 +- pom.xml | 4 +- .../ElasticsearchProperties.java | 2 +- ...asticsearchContainerAutoConfiguration.java | 1 - 7 files changed, 55 insertions(+), 47 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d6da913..26730d5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,13 +15,14 @@ jobs: steps: # Setup java environment - name: setup-java - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: temurin java-version: 11 # Checkout the git repository - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} token: ${{ secrets.GPR_TOKEN }} @@ -33,7 +34,7 @@ jobs: # Setup/load GitHub Actions caching for external dependencies, in this case especially for Maven - name: caching - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -58,7 +59,7 @@ jobs: SONAR_TOKEN: ${{ secrets.OS_SONAR_TOKEN }} run: | export SONAR_ORGANIZATION=$(echo ${GITHUB_REPOSITORY} | cut -d / -f 1) - mvn sonar:sonar \ + mvn org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar \ -Dsonar.host.url=${SONAR_HOST} \ -Dsonar.login=${SONAR_TOKEN} \ -Dsonar.organization=${SONAR_ORGANIZATION} \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3879c8d..75093ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,8 +19,9 @@ jobs: steps: # Setup java environment - name: setup-java - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: temurin java-version: 11 server-id: ossrh server-username: OSSRH_USERNAME @@ -38,7 +39,7 @@ jobs: # Checkout the git repository - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} token: ${{ secrets.GPR_TOKEN }} @@ -50,7 +51,7 @@ jobs: # Setup GitHub Actions caching for external dependencies, in this case especially for Maven - name: caching - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -71,7 +72,7 @@ jobs: SONAR_TOKEN: ${{ secrets.OS_SONAR_TOKEN }} run: | export SONAR_ORGANIZATION=$(echo ${GITHUB_REPOSITORY} | cut -d / -f 1) - mvn sonar:sonar \ + mvn org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar \ -Dsonar.host.url=${SONAR_HOST} \ -Dsonar.login=${SONAR_TOKEN} \ -Dsonar.organization=${SONAR_ORGANIZATION} \ @@ -81,7 +82,7 @@ jobs: # Get the current project version from POM - name: get-project-version id: get_project_version - uses: avides/actions-project-version-check@v1 + uses: avides/actions-project-version-check@v2 with: token: ${{ secrets.GITHUB_TOKEN }} file-to-check: pom.xml @@ -93,19 +94,16 @@ jobs: env: PROJECT_VERSION: ${{ steps.get_project_version.outputs.version }} run: | - echo ::set-output name=gitcommitmessage::$(git log --no-merges -1 --oneline) + echo "gitcommitmessage=$(git log --no-merges -1 --oneline)" >> $GITHUB_OUTPUT if [[ "$PROJECT_VERSION" == *"SNAPSHOT"* || "$PROJECT_VERSION" == *"RC"* ]]; then - echo ::set-output name=isprerelease::true + echo "isprerelease=true" >> $GITHUB_OUTPUT fi # Create and publish GitHub Release tag - name: github-release - uses: actions/create-release@v1 - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} + uses: softprops/action-gh-release@v2 with: + token: ${{ secrets.GPR_TOKEN }} tag_name: ${{ steps.get_project_version.outputs.version }} - release_name: ${{ steps.get_project_version.outputs.version }} body: ${{ steps.setup_github_release.outputs.gitcommitmessage }} prerelease: ${{ steps.setup_github_release.outputs.isprerelease }} diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index e358957..905dcec 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -9,25 +9,24 @@ on: jobs: review: timeout-minutes: 30 - + runs-on: ubuntu-latest - steps: - # Cancels previous run for this branch that have a different commit id (SHA) - - name: cancel-previous-run - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: # Setup java environment - name: setup-java - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: temurin java-version: 11 # Checkout the git repository - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} token: ${{ secrets.GPR_TOKEN }} @@ -39,14 +38,14 @@ jobs: # Update GitHub Action configuration if necessary - name: action-configuration-autoupdate - uses: avides/actions-action-configuration-autoupdate@v1 + uses: avides/actions-action-configuration-autoupdate@v2 with: token: ${{ secrets.GPR_TOKEN }} actions-configuration-files: os-java-library/nightly.yml,os-java-library/release.yml,os-java-library/review.yml source-repository: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_REPO }} # Push updated GitHub Actions configuration if necessary - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@v5 with: file_pattern: .github/workflows/*.yml commit_user_name: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_USER }} @@ -56,34 +55,45 @@ jobs: # Verify project version is updated - name: project-version-check - uses: avides/actions-project-version-check@v1 + uses: avides/actions-project-version-check@v2 with: token: ${{ secrets.GITHUB_TOKEN }} file-to-check: pom.xml additional-files-to-check: README.md - # Check if documentation reminder comment is already given - - name: find-documentation-reminder-comment - uses: peter-evans/find-comment@v1 - id: find_documentation_reminder_comment + # Check if reminder comment is already given + - name: find-reminder-comment + uses: peter-evans/find-comment@v3 + id: find_reminder_comment with: issue-number: ${{ github.event.number }} body-includes: "Confluence/GitHub documentation added or updated?" - # Add documentation reminder comment if not given - - name: documentation-reminder-comment - uses: jungwinter/comment@v1 + # Add reminder comment if not given + - name: reminder-comment + uses: peter-evans/create-or-update-comment@v4 id: create - if: ${{ steps.find_documentation_reminder_comment.outputs.comment-id == 0 }} + if: ${{ steps.find_reminder_comment.outputs.comment-id == 0 }} with: - type: create - body: 'Confluence/GitHub documentation added or updated?' - issue_number: ${{ github.event.number }} + body: | + - Confluence/GitHub documentation added or updated? + - Diff-Links as response added? + - [ ] Not necessary + - [ ] Added + + - [Breaking-Change]() present? + - Necessary deployment adjustments added as a comment (Jira-Ticket)? + - [ ] Not necessary + - [ ] Added + - Necessary rollback adjustments added as a comment (Jira-Ticket)? + - [ ] Not necessary + - [ ] Added + issue-number: ${{ github.event.number }} token: ${{ secrets.GITHUB_TOKEN }} # Setup/load GitHub Actions caching for external dependencies, in this case especially for Maven - name: caching - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -109,7 +119,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | export SONAR_ORGANIZATION=$(echo ${GITHUB_REPOSITORY} | cut -d / -f 1) - mvn sonar:sonar \ + mvn org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar \ -Dsonar.host.url=${SONAR_HOST} \ -Dsonar.login=${SONAR_TOKEN} \ -Dsonar.organization=${SONAR_ORGANIZATION} \ diff --git a/README.md b/README.md index e5a434e..4561636 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ com.avides.springboot.springtainer springtainer-elasticsearch - 1.4.0 + 2.0.0 test ``` @@ -25,7 +25,7 @@ Properties consumed (in `bootstrap.properties`): - `embedded.container.elasticsearch.enabled` (default is `true`) - `embedded.container.elasticsearch.startup-timeout` (default is `30`) -- `embedded.container.elasticsearch.docker-image` (default is `docker.elastic.co/elasticsearch/elasticsearch:7.17.9`) +- `embedded.container.elasticsearch.docker-image` (default is `docker.elastic.co/elasticsearch/elasticsearch:8.17.3`) - `embedded.container.elasticsearch.http-port` (default is `9200`) - `embedded.container.elasticsearch.transport-host` (default is `9300`) diff --git a/pom.xml b/pom.xml index 1571358..116fce2 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.avides.springboot.springtainer springtainer-elasticsearch - 1.4.0 + 2.0.0 springtainer-elasticsearch Elasticsearch test-container @@ -63,7 +63,7 @@ 1.18.26 4.13.2 1.7.36 - 4.3.10 + 4.4.18 2.13.4 0.8.8 diff --git a/src/main/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchProperties.java b/src/main/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchProperties.java index bce69ef..22b9b3b 100644 --- a/src/main/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchProperties.java +++ b/src/main/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchProperties.java @@ -22,6 +22,6 @@ public class ElasticsearchProperties extends AbstractEmbeddedContainerProperties public ElasticsearchProperties() { - setDockerImage("docker.elastic.co/elasticsearch/elasticsearch:7.17.9"); + setDockerImage("docker.elastic.co/elasticsearch/elasticsearch:8.17.3"); } } diff --git a/src/main/java/com/avides/springboot/springtainer/elasticsearch/EmbeddedElasticsearchContainerAutoConfiguration.java b/src/main/java/com/avides/springboot/springtainer/elasticsearch/EmbeddedElasticsearchContainerAutoConfiguration.java index 21cc51f..306a56d 100644 --- a/src/main/java/com/avides/springboot/springtainer/elasticsearch/EmbeddedElasticsearchContainerAutoConfiguration.java +++ b/src/main/java/com/avides/springboot/springtainer/elasticsearch/EmbeddedElasticsearchContainerAutoConfiguration.java @@ -50,7 +50,6 @@ protected List getEnvs() List envs = new ArrayList<>(); envs.add("discovery.type=single-node"); envs.add("xpack.security.enabled=false"); - envs.add("xpack.monitoring.enabled=false"); envs.add("xpack.ml.enabled=false"); envs.add("xpack.graph.enabled=false"); envs.add("xpack.watcher.enabled=false"); From bf87dcb35cc5f860a77e6d292fa32d5a698180b4 Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 13:53:43 +0100 Subject: [PATCH 2/8] fix tests --- .../springtainer/elasticsearch/AbstractIT.java | 10 +++++++++- .../elasticsearch/ElasticsearchPropertiesTest.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/avides/springboot/springtainer/elasticsearch/AbstractIT.java b/src/test/java/com/avides/springboot/springtainer/elasticsearch/AbstractIT.java index 8097d1f..83059dc 100644 --- a/src/test/java/com/avides/springboot/springtainer/elasticsearch/AbstractIT.java +++ b/src/test/java/com/avides/springboot/springtainer/elasticsearch/AbstractIT.java @@ -15,6 +15,7 @@ import org.springframework.data.elasticsearch.core.query.IndexQuery; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.ReflectionUtils; import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.core.DockerClientBuilder; @@ -53,7 +54,14 @@ public ElasticsearchRestTemplate elasticsearchRestTemplate() { var builder = RestClient.builder(new HttpHost(host, port)); var client = new RestHighLevelClient(builder); - + ReflectionUtils.doWithFields(RestHighLevelClient.class, field -> + { + if (field.getName().equals("useAPICompatibility")) + { + ReflectionUtils.makeAccessible(field); + field.setBoolean(client, true); + } + }); return new ElasticsearchRestTemplate(client); } } diff --git a/src/test/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchPropertiesTest.java b/src/test/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchPropertiesTest.java index 1271d0f..b0f64eb 100644 --- a/src/test/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchPropertiesTest.java +++ b/src/test/java/com/avides/springboot/springtainer/elasticsearch/ElasticsearchPropertiesTest.java @@ -13,7 +13,7 @@ public void testDefaults() var properties = new ElasticsearchProperties(); assertTrue(properties.isEnabled()); assertEquals(30, properties.getStartupTimeout()); - assertEquals("docker.elastic.co/elasticsearch/elasticsearch:7.17.9", properties.getDockerImage()); + assertEquals("docker.elastic.co/elasticsearch/elasticsearch:8.17.3", properties.getDockerImage()); assertEquals(9200, properties.getHttpPort()); assertEquals(9300, properties.getTransportPort()); From 54f3ee5e60af19abc986c732af441f00ece125f2 Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 14:32:31 +0100 Subject: [PATCH 3/8] test --- .github/workflows/review.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 905dcec..a666870 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -36,13 +36,7 @@ jobs: - name: post-checkout run: git fetch --prune --unshallow - # Update GitHub Action configuration if necessary - - name: action-configuration-autoupdate - uses: avides/actions-action-configuration-autoupdate@v2 - with: - token: ${{ secrets.GPR_TOKEN }} - actions-configuration-files: os-java-library/nightly.yml,os-java-library/release.yml,os-java-library/review.yml - source-repository: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_REPO }} + # Push updated GitHub Actions configuration if necessary - uses: stefanzweifel/git-auto-commit-action@v5 @@ -119,7 +113,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | export SONAR_ORGANIZATION=$(echo ${GITHUB_REPOSITORY} | cut -d / -f 1) - mvn org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar \ + mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ -Dsonar.host.url=${SONAR_HOST} \ -Dsonar.login=${SONAR_TOKEN} \ -Dsonar.organization=${SONAR_ORGANIZATION} \ From 65f8c3a585435c672227ca490c8f04e6c4f97f65 Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 14:39:41 +0100 Subject: [PATCH 4/8] test --- .github/workflows/review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index a666870..e546909 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -22,7 +22,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 11 + java-version: 17 # Checkout the git repository - name: checkout From 4d88124ffedf3428d278f8492ed3ca069775f57f Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 15:13:16 +0100 Subject: [PATCH 5/8] LIBS-1490 - test --- .github/workflows/review.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index e546909..ee4cd28 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -36,8 +36,6 @@ jobs: - name: post-checkout run: git fetch --prune --unshallow - - # Push updated GitHub Actions configuration if necessary - uses: stefanzweifel/git-auto-commit-action@v5 with: @@ -113,7 +111,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | export SONAR_ORGANIZATION=$(echo ${GITHUB_REPOSITORY} | cut -d / -f 1) - mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ + mvn org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar \ -Dsonar.host.url=${SONAR_HOST} \ -Dsonar.login=${SONAR_TOKEN} \ -Dsonar.organization=${SONAR_ORGANIZATION} \ From 4516b45296d9d6ea49cfed2e3779c963fda19022 Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 15:25:12 +0100 Subject: [PATCH 6/8] fix --- .github/workflows/review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index ee4cd28..33fb86d 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -9,7 +9,7 @@ on: jobs: review: timeout-minutes: 30 - + runs-on: ubuntu-latest concurrency: From 57c31bc5d7b9be47b2141628a095db745769e096 Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 15:58:19 +0100 Subject: [PATCH 7/8] fix github actions --- .github/workflows/nightly.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/review.yml | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 26730d5..01109b2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -18,7 +18,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 11 + java-version: 17 # Checkout the git repository - name: checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75093ce..e54bfb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 11 + java-version: 17 server-id: ossrh server-username: OSSRH_USERNAME server-password: OSSRH_PASSWORD diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 33fb86d..1675602 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -9,7 +9,7 @@ on: jobs: review: timeout-minutes: 30 - + runs-on: ubuntu-latest concurrency: @@ -36,6 +36,14 @@ jobs: - name: post-checkout run: git fetch --prune --unshallow + # Update GitHub Action configuration if necessary + - name: action-configuration-autoupdate + uses: avides/actions-action-configuration-autoupdate@v2 + with: + token: ${{ secrets.GPR_TOKEN }} + actions-configuration-files: os-java-library/nightly.yml,os-java-library/release.yml,os-java-library/review.yml + source-repository: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_REPO }} + # Push updated GitHub Actions configuration if necessary - uses: stefanzweifel/git-auto-commit-action@v5 with: From 07574a26d559f8b935bb10b506d38109cccbfe8c Mon Sep 17 00:00:00 2001 From: fegbers Date: Tue, 25 Mar 2025 16:28:03 +0100 Subject: [PATCH 8/8] fix --- .../META-INF/additional-spring-configuration-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json index beaf499..f61eebc 100644 --- a/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -17,7 +17,7 @@ "name": "embedded.container.elasticsearch.docker-image", "type": "java.lang.String", "description": "Docker-image", - "defaultValue": "docker.elastic.co/elasticsearch/elasticsearch:7.17.9" + "defaultValue": "docker.elastic.co/elasticsearch/elasticsearch:8.17.3" }, { "name": "embedded.container.elasticsearch.http-port",