From 28ae2361764b028042409ab4dbd572d1604f439a Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Wed, 10 Apr 2024 14:37:31 +0300 Subject: [PATCH 1/5] Update some dependencies --- build.gradle | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 3948c51..4669855 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,10 @@ repositories { name = 'clojars' url = 'https://repo.clojars.org' } + redhatEA { + name = 'redhatEA' + url = 'https://maven.repository.redhat.com/earlyaccess/all/' + } } sourceCompatibility = 1.8 @@ -88,13 +92,13 @@ configurations { } dependencies { - implementation "org.clojure:clojure:1.10.1" - implementation "org.clojure:core.match:0.3.0-alpha5" - implementation "org.clojure:core.memoize:0.5.9" + implementation "org.clojure:clojure:1.11.2" + implementation "org.clojure:core.match:1.1.0" + implementation "org.clojure:core.memoize:1.1.266" implementation "slingshot:slingshot:0.12.2" - implementation "org.yaml:snakeyaml:1.23" - implementation "cheshire:cheshire:5.8.0" - implementation ("selmer:selmer:1.12.27") { // templating lib + implementation 'org.yaml:snakeyaml:1.33.0.SP1-redhat-00001' + implementation "cheshire:cheshire:5.13.0" + implementation ("selmer:selmer:1.12.59") { // templating lib exclude module: 'hiccups' exclude module: 'cheshire' exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core' From 17a93d348bf3feb0563ef7a7747b5031df29d542 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Wed, 10 Apr 2024 15:10:23 +0300 Subject: [PATCH 2/5] Modify build pipeline to get some logs.. and some dependencies --- .github/workflows/buildAndDeploy.yml | 54 +++++++++++++++++++--------- build.gradle | 3 +- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/.github/workflows/buildAndDeploy.yml b/.github/workflows/buildAndDeploy.yml index 231db4f..b433d52 100644 --- a/.github/workflows/buildAndDeploy.yml +++ b/.github/workflows/buildAndDeploy.yml @@ -9,20 +9,28 @@ jobs: name: Build Cass Config Builder Docker Image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: github.event_name == 'pull_request' with: ref: ${{ github.event.pull_request.head.sha }} submodules: true - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: github.event_name != 'pull_request' with: submodules: true - - name: Login to GitHub Package Registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.actor }}" --password-stdin - - name: Setup Buildx - id: buildx - uses: crazy-max/ghaction-docker-buildx@v3 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + - name: Login to DockerHub + if: ${{ !env.ACT }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Cache Docker layers uses: actions/cache@v3 id: cache @@ -32,19 +40,31 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- java-version: 1.8 - - name: Run tests - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'datastax/cass-config-builder' - env: - ORG_GRADLE_PROJECT_dockerRegistry: docker.pkg.github.com - ORG_GRADLE_PROJECT_dockerRegistryUsername: ${{ github.actor }} - ORG_GRADLE_PROJECT_dockerRegistryPassword: ${{ secrets.GITHUB_TOKEN }} - uses: eskatos/gradle-command-action@v1 - with: - gradle-version: 6.0.1 - arguments: test + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Build with Gradle + run: ./gradlew test + + # - name: Run tests + # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'datastax/cass-config-builder' + # env: + # ORG_GRADLE_PROJECT_dockerRegistry: docker.pkg.github.com + # ORG_GRADLE_PROJECT_dockerRegistryUsername: ${{ github.actor }} + # ORG_GRADLE_PROJECT_dockerRegistryPassword: ${{ secrets.GITHUB_TOKEN }} + # uses: eskatos/gradle-command-action@v1 + # with: + # gradle-version: 6.0.1 + # arguments: test - name: Build docker image env: GITHUB_REPO_OWNER: ${{ github.repository_owner }} run: | export GITHUB_REPO_URL="https://github.com/${{ github.repository }}" ./scripts/build-push-images.sh + - name: Archive build logs + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: gradle-logs + path: build/reports + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4669855..8ccc125 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,7 @@ repositories { name = 'clojars' url = 'https://repo.clojars.org' } - redhatEA { + maven { name = 'redhatEA' url = 'https://maven.repository.redhat.com/earlyaccess/all/' } @@ -98,6 +98,7 @@ dependencies { implementation "slingshot:slingshot:0.12.2" implementation 'org.yaml:snakeyaml:1.33.0.SP1-redhat-00001' implementation "cheshire:cheshire:5.13.0" + implementation 'commons-codec:commons-codec:1.16.1' implementation ("selmer:selmer:1.12.59") { // templating lib exclude module: 'hiccups' exclude module: 'cheshire' From 13fcabd9b4faa11b6445c5b4d366fa2cbf52514a Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Wed, 10 Apr 2024 16:14:28 +0300 Subject: [PATCH 3/5] Modify test to verify the error message contains, not is with line restrictions in pkgs --- test/com/datastax/configbuilder/operator_test.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/com/datastax/configbuilder/operator_test.clj b/test/com/datastax/configbuilder/operator_test.clj index 11e0d13..9bdc08b 100644 --- a/test/com/datastax/configbuilder/operator_test.clj +++ b/test/com/datastax/configbuilder/operator_test.clj @@ -26,7 +26,7 @@ :definitions-location test-data/definitions-location}) (is false "Malformed input was not detected") (catch Exception e - (is (= "Unexpected end-of-input within/between Object entries\n at [Source: (StringReader); line: 1, column: 31]" + (is (contains "Unexpected end-of-input within/between Object entries" (.getMessage e)) "Wrong error thrown")))) (testing "ensure all files generated" From e5973c569b398e24aaf1afd589bee578ff7346fa Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Wed, 10 Apr 2024 16:29:03 +0300 Subject: [PATCH 4/5] Use clojure.string/includes? instead of contains --- test/com/datastax/configbuilder/operator_test.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/com/datastax/configbuilder/operator_test.clj b/test/com/datastax/configbuilder/operator_test.clj index 9bdc08b..5998043 100644 --- a/test/com/datastax/configbuilder/operator_test.clj +++ b/test/com/datastax/configbuilder/operator_test.clj @@ -26,8 +26,7 @@ :definitions-location test-data/definitions-location}) (is false "Malformed input was not detected") (catch Exception e - (is (contains "Unexpected end-of-input within/between Object entries" - (.getMessage e)) + (is (clojure.string/includes? (.getMessage e) "Unexpected end-of-input within/between Object entries") "Wrong error thrown")))) (testing "ensure all files generated" (sut/make-configs From ae0616bb43203069ea857713c4cd6c77ea78a593 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Wed, 10 Apr 2024 16:46:30 +0300 Subject: [PATCH 5/5] Update github actions --- .github/workflows/buildAndDeploy.yml | 17 +++-------------- .github/workflows/release.yml | 15 +++++++++------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/buildAndDeploy.yml b/.github/workflows/buildAndDeploy.yml index b433d52..b958b85 100644 --- a/.github/workflows/buildAndDeploy.yml +++ b/.github/workflows/buildAndDeploy.yml @@ -30,9 +30,9 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Cache Docker layers - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache with: path: /tmp/.buildx-cache @@ -44,17 +44,6 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Build with Gradle run: ./gradlew test - - # - name: Run tests - # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'datastax/cass-config-builder' - # env: - # ORG_GRADLE_PROJECT_dockerRegistry: docker.pkg.github.com - # ORG_GRADLE_PROJECT_dockerRegistryUsername: ${{ github.actor }} - # ORG_GRADLE_PROJECT_dockerRegistryPassword: ${{ secrets.GITHUB_TOKEN }} - # uses: eskatos/gradle-command-action@v1 - # with: - # gradle-version: 6.0.1 - # arguments: test - name: Build docker image env: GITHUB_REPO_OWNER: ${{ github.repository_owner }} @@ -63,7 +52,7 @@ jobs: ./scripts/build-push-images.sh - name: Archive build logs if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: gradle-logs path: build/reports diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2e333f..ddfdc87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,16 +10,19 @@ jobs: name: Release Cass Config Builder runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - name: Login to DockerHub - run: echo "${{ secrets.DOCKERHUB_PASS }}" | docker login -u "${{ secrets.DOCKERHUB_USER }}" --password-stdin - - name: Setup Buildx - id: buildx - uses: crazy-max/ghaction-docker-buildx@v3 + if: ${{ !env.ACT }} + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_PASS }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Cache Docker layers - uses: actions/cache@v2 + uses: actions/cache@v4 id: cache with: path: /tmp/.buildx-cache