[CLIENT-3033] Add CI/CD workflow that tests proxy client against a proxy server build from JFrog #29
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 }} | |
- name: Get the latest tag for proxy server | |
run: echo LATEST_TAG=$(docker images ${{ vars.JFROG_PROXY_SERVER_DOCKER_REPO }} --format json | jq -r '.Tag' | head -n 1) >> $GITHUB_ENV | |
# Enables pipefail | |
shell: bash | |
- name: Get CPU architecture for Docker image | |
run: echo IMAGE_ARCH=$(docker image inspect --format json ${{ vars.JFROG_PROXY_SERVER_DOCKER_REPO }}:${{ env.LATEST_TAG }} | jq -r ".[0].Architecture") >> $GITHUB_ENV | |
shell: bash | |
- name: If needed, use QEMU to emulate ARM | |
if: ${{ env.IMAGE_ARCH == 'arm64' }} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- 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 -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.proxy.tests.ProxyTests -DfailIfNoTests=false | |
# TODO: For debugging. Remove later | |
- if: ${{ always() }} | |
run: docker container ps -a | |
- if: ${{ always() }} | |
run: docker logs aerospike | |
- if: ${{ always() }} | |
run: docker logs aerospike-proxy | |
- 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: Create release bundle from JFrog build | |
run: jf release-bundle-create aerospike-java-proxy-client |