diff --git a/.github/workflows/build-proxy.yml b/.github/workflows/build-proxy.yml index 47ee21021..0ecb07522 100644 --- a/.github/workflows/build-proxy.yml +++ b/.github/workflows/build-proxy.yml @@ -1,6 +1,7 @@ name: Build and upload proxy client to JFrog on: + pull_request: push: branches: - stage @@ -8,18 +9,105 @@ on: jobs: build: - runs-on: ubuntu-latest + env: + JFROG_RELEASE_BUNDLE_NAME: aerospike-java-proxy-client + runs-on: ubuntu-22.04 steps: - name: Checkout Java client - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Set up settings.xml for Maven - uses: s4u/maven-settings-action@v2.8.0 + # mvn deploy + # - name: Set up settings.xml for Maven + # uses: s4u/maven-settings-action@v2.8.0 + # with: + # servers: '[{"id": "snapshots", "username": "${{ secrets.JFROG_USERNAME }}", "password": "${{ secrets.JFROG_MAVEN_TOKEN }}"}]' + + - run: docker login aerospike.jfrog.io --username ${{ secrets.JFROG_USERNAME }} --password ${{ secrets.JFROG_DOCKER_TOKEN }} + + # TODO: change to use "latest" tag + + - name: Get all tags for proxy server Docker image + run: docker pull --all-tags ${{ vars.JFROG_PROXY_SERVER_DOCKER_REPO }} + + # If we try to emulate aarch64 and run a proxy server Docker image designed for aarch64, the log file won't exist in the container + # i.e there won't be any output in `docker logs` for the proxy server. + # so we can't tell if the proxy server is running or not + - name: Get the latest tag for proxy server for this CPU platform + run: echo LATEST_TAG=$(docker images --filter label="architecture=$(uname -m)" ${{ vars.JFROG_PROXY_SERVER_DOCKER_REPO }} --format json | jq -r '.Tag' | head -n 1) >> $GITHUB_ENV + # Enables pipefail + shell: bash + + - run: docker compose up -d + working-directory: .github/workflows/test-configs + env: + PROXY_SERVER_TAG: ${{ env.LATEST_TAG }} + + # We assume that the proxy server is ready once we run the tests + + - uses: jfrog/setup-jfrog-cli@v4 + env: + JF_URL: "https://aerospike.jfrog.io" + JF_USER: ${{ secrets.JFROG_USERNAME }} + JF_PASSWORD: ${{ secrets.JFROG_MAVEN_TOKEN }} + JF_PROJECT: "clients" + + # This associates the Maven credentials with the repos in the Java client's pom.xml + - run: jf mvn-config --repo-deploy-releases clients-maven-dev-local --repo-deploy-snapshots clients-maven-dev-local + + # There can be a Maven plugin to get the proxy client version + # But this also works, too + - run: sudo apt install -y libxml-xpath-perl + + - name: Get Java proxy client version + id: get-proxy-client-version + # TODO: find a way to do this via java ecosystem instead of using generic cli tools + run: echo version=$(xpath -q -e "//project/version/text()" pom.xml) >> $GITHUB_OUTPUT + + - uses: aerospike/shared-workflows/devops/setup-gpg@052d1b0a751414b0e03d12271bb7d09a4fe2dde0 with: - servers: '[{"id": "snapshots_private", "username": "${{ secrets.JFROG_USERNAME }}", "password": "${{ secrets.JFROG_MAVEN_TOKEN }}"}]' + gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + gpg-key-pass: ${{ secrets.GPG_PASS }} + gpg-key-name: "aerospike-inc" + + - run: echo -e "passphrase-file $HOME/pass" >> ~/.gnupg/gpg.conf + + - name: Run Maven workflow + run: jf mvn deploy -Dtest=com.aerospike.test.SuiteAll -DfailIfNoTests=false -DskipTests=true --build-name=${{ steps.get-proxy-client-version.outputs.version }} --build-number=${{ github.run_number }} + + # For debugging the build info that was just collected by jf + # Build info was not published to JFrog yet. This will be done in a later step + - run: cat target/build-info.json + # For debugging why the proxy server failed to start + - if: ${{ always() }} + run: docker container ps -a + # Prints logs for native server and proxy server + - if: ${{ always() }} + run: docker logs test-configs-proxy-server-1 + - if: ${{ always() }} + run: docker logs test-configs-native-server-1 + + # Based on https://github.com/citrusleaf/devops/blob/master/jfrog/vector/deploy-to-jfrog.sh + + - name: Publish JFrog build info from uploaded artifacts + run: jf rt build-publish ${{ steps.get-proxy-client-version.outputs.version }} ${{ github.run_number }} + + # Required to run sponge + - run: sudo apt install -y moreutils + + # .files.project is not documented in JFrog but it's used to specify the JFrog project to upload this release bundle to + - name: Create file spec for release bundle + run: cat releasebundle-filespec.json | jq '.files[0].build = "${{ steps.get-proxy-client-version.outputs.version }}/${{ github.run_number }}"' | sponge releasebundle-filespec.json + working-directory: .github/workflows + shell: bash - - name: Build Java client - run: mvn install + - name: Create release bundle from JFrog build + # Not the same name as in proxy/pom.xml + # But that name doesn't specify the language, + # and there can be multiple languages that implement the proxy client in the future that need to be uploaded to JFrog + # Signing key only signs release bundle and not the artifacts associated with it + run: jf release-bundle-create --signing-key=aerospike --sync --spec=./releasebundle-filespec.json ${{ env.JFROG_RELEASE_BUNDLE_NAME }} ${{ steps.get-proxy-client-version.outputs.version }} + working-directory: .github/workflows - - name: Upload to JFrog - run: mvn deploy + - name: Promote release bundle to DEV stage + run: jf release-bundle-promote --signing-key=aerospike --sync ${{ env.JFROG_RELEASE_BUNDLE_NAME }} ${{ steps.get-proxy-client-version.outputs.version }} DEV + working-directory: .github/workflows diff --git a/.github/workflows/releasebundle-filespec.json b/.github/workflows/releasebundle-filespec.json new file mode 100644 index 000000000..262bf910e --- /dev/null +++ b/.github/workflows/releasebundle-filespec.json @@ -0,0 +1,8 @@ +{ + "files": [ + { + "pattern": "", + "project": "clients" + } + ] +} diff --git a/.github/workflows/test-configs/Dockerfile b/.github/workflows/test-configs/Dockerfile new file mode 100644 index 000000000..c40fdd8b6 --- /dev/null +++ b/.github/workflows/test-configs/Dockerfile @@ -0,0 +1,9 @@ +ARG PROXY_SERVER_TAG +FROM "aerospike.jfrog.io/docker/aerospike/aerospike-proxy-private:$PROXY_SERVER_TAG" +# Default user "aerospike" doesn't have root permissions +USER root +RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq +RUN chmod +x /usr/bin/yq +RUN yq -i e 'del(.security)' /etc/aerospike-proxy/aerospike-proxy.yml +RUN yq -i e '.aerospike.seeds[0].native-server = .aerospike.seeds[0].localhost' /etc/aerospike-proxy/aerospike-proxy.yml +RUN yq -i e 'del(.aerospike.seeds[0].localhost)' /etc/aerospike-proxy/aerospike-proxy.yml diff --git a/.github/workflows/test-configs/compose.yml b/.github/workflows/test-configs/compose.yml new file mode 100644 index 000000000..3fb9dc208 --- /dev/null +++ b/.github/workflows/test-configs/compose.yml @@ -0,0 +1,16 @@ +services: + native-server: + image: aerospike/aerospike-server + ports: + # TODO: maybe not necessary since we don't access it directly + - "3000:3000" + proxy-server: + depends_on: + - native-server + # dockerfile_inline doesn't work for some reason, even though it's documented. + # So we have to supply the Dockerfile as a separate file + build: + args: + - PROXY_SERVER_TAG + ports: + - "4000:4000" diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index cb4b52b73..4ebbd8ba8 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -6,7 +6,7 @@ com.aerospike aerospike-parent - 8.1.4 + 8.1.4-SNAPSHOT aerospike-benchmarks jar diff --git a/client/pom.xml b/client/pom.xml index dfe67163a..dbd07c274 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -6,7 +6,7 @@ com.aerospike aerospike-parent - 8.1.4 + 8.1.4-SNAPSHOT aerospike-client-jdk8 jar @@ -78,6 +78,10 @@ + + org.apache.maven.plugins + maven-gpg-plugin + org.apache.maven.plugins maven-compiler-plugin diff --git a/examples/pom.xml b/examples/pom.xml index fad839b13..6fd2b6ee6 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -6,7 +6,7 @@ com.aerospike aerospike-parent - 8.1.4 + 8.1.4-SNAPSHOT aerospike-examples jar diff --git a/pom.xml b/pom.xml index 359cdd7f7..43cdf103f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.aerospike aerospike-parent aerospike-parent - 8.1.4 + 8.1.4-SNAPSHOT pom https://github.com/aerospike/aerospike-client-java @@ -138,6 +138,20 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.5 + + + sign-artifacts + verify + + sign + + + + maven-compiler-plugin ${maven-compiler-plugin.version} @@ -170,4 +184,16 @@ --> + + + central + aerospike-artifactory-primary-0-releases + https://aerospike.jfrog.io/artifactory/clients-maven-dev-local + + + snapshots + aerospike-artifactory-primary-0-snapshots + https://aerospike.jfrog.io/artifactory/clients-maven-dev-local + + diff --git a/proxy/pom.xml b/proxy/pom.xml index 9be7dce26..74f10e2b1 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -6,7 +6,7 @@ com.aerospike aerospike-parent - 8.1.4 + 8.1.4-SNAPSHOT aerospike-proxy-client jar @@ -27,11 +27,13 @@ io.grpc + ${grpc.version} grpc-netty io.netty + ${netty.version} netty-transport @@ -80,6 +82,10 @@ + + org.apache.maven.plugins + maven-gpg-plugin + org.apache.maven.plugins maven-compiler-plugin diff --git a/test/pom.xml b/test/pom.xml index 1ed1b89a9..4923ee984 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -6,7 +6,7 @@ com.aerospike aerospike-parent - 8.1.4 + 8.1.4-SNAPSHOT aerospike-client-test jar diff --git a/test/src/com/aerospike/test/SuiteAll.java b/test/src/com/aerospike/test/SuiteAll.java index d3a3e6d40..4d3797900 100644 --- a/test/src/com/aerospike/test/SuiteAll.java +++ b/test/src/com/aerospike/test/SuiteAll.java @@ -21,8 +21,9 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ - SuiteSync.class, - SuiteAsync.class + // SuiteSync.class, + // SuiteAsync.class, + SuiteProxy.class }) public class SuiteAll { } diff --git a/test/src/com/aerospike/test/SuiteProxy.java b/test/src/com/aerospike/test/SuiteProxy.java index 2e5657ea0..62c8ada93 100644 --- a/test/src/com/aerospike/test/SuiteProxy.java +++ b/test/src/com/aerospike/test/SuiteProxy.java @@ -51,6 +51,7 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ + // TODO: add test for username and password with proxy client TestAsyncPutGet.class, TestAsyncBatch.class, TestAsyncOperate.class,