From de44ba78dbf9a93a7d23ca6b257b717763ed2e0d Mon Sep 17 00:00:00 2001 From: Giuseppe Villani Date: Fri, 30 Aug 2024 11:18:16 +0200 Subject: [PATCH] De-ignore and solve failing docker tests in 5.23 (#4174) * Revert "Provisionally ignored failing docker tests in 5.20 (#4085)" This reverts commit 05bb7ffdade90cfb6886a7a582413b074eccd0ef. * update gradle version and syntax * added empty CODEARTIFACT_DOWNLOAD_URL * add codeartifact references * added gradle prints * removed teamcity-repository.gradle * try restoring gradle version * restored ci.yaml like dev one * changed maven repo to codeartifact_url * try upgrading version * [NOID] Improving AWS cli call to retrieve latest neo4j_version from CodeArtifact * restored neo4j version * restored ci.yaml like dev one * try changing NEO4J_VERSION_CI to NEO4JVERSION --------- Co-authored-by: Omar Ahmad --- .../actions/test-gradle-project/action.yml | 4 +- .github/workflows/CI.yaml | 54 ++++++++++++++++--- build.gradle | 24 ++++++++- .../test/java/apoc/neo4j/docker/BoltTest.java | 2 - .../apoc/neo4j/docker/CoreExtendedTest.java | 2 - .../neo4j/docker/StartupExtendedTest.java | 2 - teamcity-repository.gradle | 8 +-- 7 files changed, 76 insertions(+), 20 deletions(-) diff --git a/.github/actions/test-gradle-project/action.yml b/.github/actions/test-gradle-project/action.yml index 52a149ef26..bc39f2a6f7 100644 --- a/.github/actions/test-gradle-project/action.yml +++ b/.github/actions/test-gradle-project/action.yml @@ -12,10 +12,10 @@ runs: - uses: ./.github/actions/setup-gradle-cache - name: Run compile tests shell: bash - run: ./gradlew :${{inputs.project-name}}:compileJava :${{inputs.project-name}}:compileTestJava + run: ./gradlew --info -Pneo4jVersionOverride=$NEO4JVERSION :${{inputs.project-name}}:compileJava :${{inputs.project-name}}:compileTestJava - name: Run tests shell: bash - run: ./gradlew :${{inputs.project-name}}:check --parallel + run: ./gradlew --info -Pneo4jVersionOverride=$NEO4JVERSION :${{inputs.project-name}}:check --parallel - name: Archive test results uses: actions/upload-artifact@v2 if: always() diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index a278751214..4ac3396f0c 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -7,6 +7,8 @@ on: branches: [ "5.23" ] env: + CODEARTIFACT_DOWNLOAD_URL: ${{ secrets.CODEARTIFACT_DOWNLOAD_URL }} + CODEARTIFACT_USERNAME: ${{ secrets.CODEARTIFACT_USERNAME }} DOCKER_ENTERPRISE_URL: ${{ secrets.DOCKER_ENTERPRISE_DEV_URL }} DOCKER_COMMUNITY_URL: ${{ secrets.DOCKER_COMMUNITY_DEV_URL }} TEAMCITY_DEV_URL: ${{ secrets.TEAMCITY_DEV_URL }} @@ -14,7 +16,6 @@ env: TEAMCITY_PASSWORD: ${{ secrets.TEAMCITY_PASSWORD }} ENTERPRISE_TAR: enterprise-docker.tar COMMUNITY_TAR: community-docker.tar - jobs: code-ql: @@ -28,23 +29,43 @@ jobs: matrix: language: [ 'java', 'javascript' ] steps: + - name: Configure AWS CLI + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + + - name: Configure CodeArtifact Authentication Token + run: | + CODEARTIFACT_TOKEN=`aws codeartifact get-authorization-token --domain build-service-live --domain-owner ${{ secrets.AWS_ACCOUNT_ID }} --query authorizationToken --output text` + echo "::add-mask::$CODEARTIFACT_TOKEN" + echo "CODEARTIFACT_TOKEN=$CODEARTIFACT_TOKEN" >> "$GITHUB_ENV" + - uses: actions/checkout@v3 - uses: ./.github/actions/setup-jdk - uses: ./.github/actions/setup-gradle-cache + + - name: Determine latest neo4j CI version + run: | + neo4j_version_base=$(grep -e "neo4jVersion = .*" build.gradle | cut -d '=' -f 2 | tr -d \'\" | tr -d ' ') + echo "neo4j_version_base=$neo4j_version_base" + NEO4JVERSION=`aws codeartifact list-package-versions --domain build-service-live --domain-owner ${{ secrets.AWS_ACCOUNT_ID }} --repository ci-live --format maven --namespace org.neo4j --package neo4j --sort-by PUBLISHED_TIME --query "versions[?starts_with(version,'$neo4j_version_base')] | [0].version" | tr -d '" '` + echo "NEO4JVERSION=$NEO4JVERSION" >> "$GITHUB_ENV" + echo "Found NEO4j_VERSION_CI=$NEO4JVERSION" - name: Compile Java run: | chmod +x gradlew - ./gradlew --no-daemon --init-script init.gradle clean + ./gradlew --no-daemon --info -Pneo4jVersionOverride=$NEO4JVERSION --init-script init.gradle clean # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - # Autobuild attempts to build any compiled languages - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + - name: Compile + run: ./gradlew --info -Pneo4jVersionOverride=$NEO4JVERSION compileJava compileTestJava - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 @@ -58,6 +79,19 @@ jobs: project: [ 'extended', 'extended-it' ] runs-on: ubuntu-latest steps: + - name: Configure AWS CLI + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + + - name: Configure CodeArtifact Authentication Token + run: | + CODEARTIFACT_TOKEN=`aws codeartifact get-authorization-token --domain build-service-live --domain-owner ${{ secrets.AWS_ACCOUNT_ID }} --query authorizationToken --output text` + echo "::add-mask::$CODEARTIFACT_TOKEN" + echo "CODEARTIFACT_TOKEN=$CODEARTIFACT_TOKEN" >> "$GITHUB_ENV" + - uses: actions/checkout@v2 - name: Set up JDK 17 uses: actions/setup-java@v2 @@ -70,11 +104,19 @@ jobs: ~/.gradle/caches ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + + - name: Determine latest neo4j CI version + run: | + neo4j_version_base=$(grep -e "neo4jVersion = .*" build.gradle | cut -d '=' -f 2 | tr -d \'\" | tr -d ' ') + echo "neo4j_version_base=$neo4j_version_base" + NEO4JVERSION=`aws codeartifact list-package-versions --domain build-service-live --domain-owner ${{ secrets.AWS_ACCOUNT_ID }} --repository ci-live --format maven --namespace org.neo4j --package neo4j --sort-by PUBLISHED_TIME --query "versions[?starts_with(version,'$neo4j_version_base')] | [0].version" | tr -d '" '` + echo "NEO4JVERSION=$NEO4JVERSION" >> "$GITHUB_ENV" + echo "Found NEO4j_VERSION_CI=$NEO4JVERSION" - name: Init gradle run: | chmod +x gradlew - ./gradlew --init-script init.gradle + ./gradlew --info -Pneo4jVersionOverride=$NEO4JVERSION --init-script init.gradle - name: Run ${{ matrix.project }} tests uses: ./.github/actions/test-gradle-project diff --git a/build.gradle b/build.gradle index ca654b59e9..5331ec2239 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,17 @@ repositories { /*maven { // this contains the neo4j 4.0.0-beta jars url "https://neo4j.bintray.com/community/" }*/ - mavenCentral() + if (System.getenv("CODEARTIFACT_DOWNLOAD_URL") ?: "" != "") { + maven { + url System.getenv('CODEARTIFACT_DOWNLOAD_URL') + credentials { + username System.getenv('CODEARTIFACT_USERNAME') + password System.getenv('CODEARTIFACT_TOKEN') + } + } + } else { + mavenCentral() + } maven { url "https://repo.gradle.org/gradle/libs-releases" } @@ -43,7 +53,17 @@ subprojects { /*maven { // this contains the neo4j 4.0.0-beta jars url "https://neo4j.bintray.com/community/" }*/ - mavenCentral() + if (System.getenv("CODEARTIFACT_DOWNLOAD_URL") ?: "" != "") { + maven { + url System.getenv('CODEARTIFACT_DOWNLOAD_URL') + credentials { + username System.getenv('CODEARTIFACT_USERNAME') + password System.getenv('CODEARTIFACT_TOKEN') + } + } + } else { + mavenCentral() + } maven { url "https://repo.gradle.org/gradle/libs-releases" } diff --git a/extended-it/src/test/java/apoc/neo4j/docker/BoltTest.java b/extended-it/src/test/java/apoc/neo4j/docker/BoltTest.java index df3ba3eaac..508f405d5b 100644 --- a/extended-it/src/test/java/apoc/neo4j/docker/BoltTest.java +++ b/extended-it/src/test/java/apoc/neo4j/docker/BoltTest.java @@ -15,7 +15,6 @@ import org.junit.Assume; import org.junit.BeforeClass; import org.junit.ClassRule; -import org.junit.Ignore; import org.junit.Test; import org.neo4j.driver.Session; import org.neo4j.graphdb.Entity; @@ -46,7 +45,6 @@ * @author AgileLARUS * @since 29.08.17 */ -@Ignore public class BoltTest { public static String BOLT_URL; diff --git a/extended-it/src/test/java/apoc/neo4j/docker/CoreExtendedTest.java b/extended-it/src/test/java/apoc/neo4j/docker/CoreExtendedTest.java index 0236fcc786..7bbb2f4f45 100644 --- a/extended-it/src/test/java/apoc/neo4j/docker/CoreExtendedTest.java +++ b/extended-it/src/test/java/apoc/neo4j/docker/CoreExtendedTest.java @@ -2,7 +2,6 @@ import apoc.util.Neo4jContainerExtension; import apoc.util.TestContainerUtil; -import org.junit.Ignore; import org.junit.Test; import apoc.util.TestContainerUtil.ApocPackage; import org.neo4j.driver.Record; @@ -25,7 +24,6 @@ into a Neo4j instance without any startup issue. If you don't have docker installed it will fail, and you can simply ignore it. */ -@Ignore public class CoreExtendedTest { @Test public void checkForCoreAndExtended() { diff --git a/extended-it/src/test/java/apoc/neo4j/docker/StartupExtendedTest.java b/extended-it/src/test/java/apoc/neo4j/docker/StartupExtendedTest.java index 629e1f128c..7fbf4f4d5c 100644 --- a/extended-it/src/test/java/apoc/neo4j/docker/StartupExtendedTest.java +++ b/extended-it/src/test/java/apoc/neo4j/docker/StartupExtendedTest.java @@ -6,7 +6,6 @@ import apoc.util.TestContainerUtil; import apoc.util.TestContainerUtil.Neo4jVersion; import org.apache.commons.io.FileUtils; -import org.junit.Ignore; import org.junit.Test; import org.neo4j.driver.Session; @@ -30,7 +29,6 @@ /* This test is just to verify if the APOC procedures and functions are correctly deployed into a Neo4j instance without any startup issue. */ -@Ignore public class StartupExtendedTest { private static final String APOC_HELP_QUERY = "CALL apoc.help('') YIELD core, type, name WHERE core = $core and type = $type RETURN name"; private static final List EXPECTED_EXTENDED_NAMES; diff --git a/teamcity-repository.gradle b/teamcity-repository.gradle index b263ba5010..0b4cdf9d7a 100644 --- a/teamcity-repository.gradle +++ b/teamcity-repository.gradle @@ -2,11 +2,11 @@ allprojects { plugins.withType(JavaLibraryPlugin) { repositories { maven { - name = 'teamcity-neo4j-dev' - url = System.getenv('TEAMCITY_DEV_URL') + name = 'aws-codeartifact-repo' + url = System.getenv('CODEARTIFACT_DOWNLOAD_URL') credentials { - username System.getenv('TEAMCITY_USER') - password System.getenv('TEAMCITY_PASSWORD') + username System.getenv('CODEARTIFACT_USERNAME') + password System.getenv('CODEARTIFACT_TOKEN') } authentication { basic(BasicAuthentication)