[CLIENT-3033] Add CI/CD workflow that tests proxy client against a proxy server build from JFrog #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload proxy client to JFrog | |
on: | |
pull_request: | |
push: | |
branches: | |
- stage | |
# TODO: snapshots_private has been removed from base parent pom.xml. Need to add workflow code to write snapshots_private to local pipeline pom.xml (this workflow will not work until that is done) | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Java client | |
uses: actions/checkout@v4 | |
- name: Set up settings.xml for Maven | |
uses: s4u/[email protected] | |
with: | |
servers: '[{"id": "snapshots_private", "username": "${{ secrets.JFROG_USERNAME }}", "password": "${{ secrets.JFROG_MAVEN_TOKEN }}"}]' | |
- name: Build Java client | |
run: mvn install | |
- name: Run Aerospike server | |
run: docker run -d --name aerospike -p 3000:3000 aerospike/aerospike-server | |
- 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 | |
- name: Run Aerospike Proxy on latest tag | |
# TODO: not sure why aerospike-proxy.yml couldn't be included in Docker image... | |
run: docker run -d --name aerospike-proxy -p 4000:4000 --network=host -v ./aerospike-proxy.yml:/etc/aerospike-proxy/aerospike-proxy.yml ${{ vars.JFROG_PROXY_SERVER_DOCKER_REPO }}:${{ env.LATEST_TAG }} | |
working-directory: .github/workflows/test-configs | |
- name: Wait for native and proxy server to start | |
run: sleep 3 | |
- name: Run tests | |
run: mvn test -Dtest=com.aerospike.test.SuiteAll -DfailIfNoTests=false -DskipTests=false | |
# TODO: For debugging. Remove later | |
- if: ${{ always() }} | |
run: docker container ps -a | |
- if: ${{ always() }} | |
run: docker logs aerospike | |
# TODO: docker logs prints nothing. Not sure why this happens | |
- if: ${{ always() }} | |
run: docker exec aerospike-proxy cat /var/log/aerospike-proxy/aerospike-proxy.log | |
- name: Upload to JFrog | |
run: mvn deploy | |
# TODO: create release bundle | |
# Based on https://github.com/citrusleaf/devops/blob/master/jfrog/vector/deploy-to-jfrog.sh | |
- uses: jfrog/setup-jfrog-cli@v4 | |
with: | |
JF_URL: ${{ vars.JF_URL }} | |
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} | |
- 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 | |
- name: Create release bundle from JFrog build | |
run: jf release-bundle-create --project=clients --signing-key=aerospike --sync --spec=./releasebundle-filespec.json aerospike-java-proxy-client ${{ steps.get-proxy-client-version.outputs.version }} | |
working-directory: .github/workflows | |
- name: Promote release bundle to DEV stage | |
run: jf release-bundle-promote --project=clients --signing-key=aerospike --sync aerospike-java-proxy-client ${{ steps.get-proxy-client-version.outputs.version }} DEV | |
working-directory: .github/workflows |