Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLIENT-3033] Add CI/CD workflow that tests proxy client against a proxy server build from JFrog #329

Closed
wants to merge 111 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
dc54b77
Create workflow that tests proxy client against proxy server
juliannguyen4 Jul 10, 2024
c584ece
Add pr trigger
juliannguyen4 Jul 10, 2024
d812667
Remove invalid tag
juliannguyen4 Jul 10, 2024
f38fe70
Update checkout action
juliannguyen4 Jul 10, 2024
3288e0a
Authenticate with JFrog
juliannguyen4 Jul 11, 2024
4cb8aee
Use the correct link
juliannguyen4 Jul 11, 2024
ea97caf
Get latest tag without latest
juliannguyen4 Jul 11, 2024
9f0cc8e
Fix repo name
juliannguyen4 Jul 11, 2024
501fcc0
Try a different repo name
juliannguyen4 Jul 11, 2024
d3ee9de
Print logs to debug containers, wait for servers to initialize
juliannguyen4 Jul 11, 2024
5c389c4
Always print container logs so we can see them when job fails
juliannguyen4 Jul 11, 2024
7768930
Show all containers' statuses
juliannguyen4 Jul 11, 2024
44ac1af
Run QEMU if image is based on arm
juliannguyen4 Jul 11, 2024
322f16c
Only need to emulate arm64
juliannguyen4 Jul 11, 2024
2c58b70
Fix syntax
juliannguyen4 Jul 11, 2024
6a029b4
Run native server after proxy server
juliannguyen4 Jul 11, 2024
58540b5
Skip if no tests were run
juliannguyen4 Jul 11, 2024
9cb492c
Use Github variable for JFrog repo name
juliannguyen4 Jul 12, 2024
dc9dcb7
Use aerospike-proxy.yml config file
juliannguyen4 Jul 12, 2024
27d8cb9
Forgot to add config file contents, use proper path for docker volume…
juliannguyen4 Jul 12, 2024
5bd5edf
Fix spacing
juliannguyen4 Jul 12, 2024
203a719
Disable security for now
juliannguyen4 Jul 12, 2024
f765054
Revert "Run native server after proxy server"
juliannguyen4 Jul 12, 2024
357b1ae
Print proxy server logs a different way
juliannguyen4 Jul 12, 2024
e3ab967
Don't run deploy code at the end, only use proxy server x86 build
juliannguyen4 Jul 12, 2024
216cff6
Remove unnecessary step, comment
juliannguyen4 Jul 12, 2024
ee02c3a
Try a different test command
juliannguyen4 Jul 12, 2024
f0f5e6b
Just run all suites since SuiteProxy isn't in a pom.xml
juliannguyen4 Jul 12, 2024
f375096
Fix syntax
juliannguyen4 Jul 12, 2024
dd4160e
Why are we skipping the tests?
juliannguyen4 Jul 12, 2024
3668e9f
Revert "Why are we skipping the tests?"
juliannguyen4 Jul 12, 2024
3fcaba0
Don't skip tests when running mvn test
juliannguyen4 Jul 12, 2024
ad0b744
Only run proxy tests
juliannguyen4 Jul 12, 2024
30e05d7
Run proxy server on host so it can access native server through local…
juliannguyen4 Jul 12, 2024
9deccae
See what happens
juliannguyen4 Jul 15, 2024
7b6fed1
Forgot
juliannguyen4 Jul 15, 2024
fce3bff
Configure pom.xml to upload to JFrog when deploying
juliannguyen4 Jul 15, 2024
2d77728
Fix
juliannguyen4 Jul 15, 2024
296f978
Use SNAPSHOT version to upload to snapshot repo
juliannguyen4 Jul 15, 2024
beeda4f
Install xpath
juliannguyen4 Jul 15, 2024
4834eb1
release bundle cmds fail without url
juliannguyen4 Jul 15, 2024
36d7bb9
Try this fix
juliannguyen4 Jul 15, 2024
04ca9d8
Just embed JFrog url for now
juliannguyen4 Jul 15, 2024
9935899
Fix
juliannguyen4 Jul 15, 2024
de9e498
Try using maven token and JFrog username
juliannguyen4 Jul 24, 2024
1038b0c
Create JFrog build
juliannguyen4 Jul 24, 2024
74d7abc
Use clients project for publishing build
juliannguyen4 Jul 24, 2024
14673c2
Run whole maven workflow w/ one command
juliannguyen4 Jul 24, 2024
2d3b694
Configure maven first
juliannguyen4 Jul 24, 2024
80a0e52
Run deploy to call previous steps in lifecycle
juliannguyen4 Jul 24, 2024
2691b99
try unsetting to use default build info json
juliannguyen4 Jul 24, 2024
7e0cd04
Configure repos
juliannguyen4 Jul 24, 2024
b11d7fe
fix repo
juliannguyen4 Jul 24, 2024
b58a254
Set up file spec properly
juliannguyen4 Jul 24, 2024
b54c7c7
fix
juliannguyen4 Jul 24, 2024
2219a35
install
juliannguyen4 Jul 24, 2024
4b6a976
fix
juliannguyen4 Jul 24, 2024
369cc60
Print build info json
juliannguyen4 Jul 25, 2024
978f3dc
Use only the latest build in the release bundle
juliannguyen4 Jul 25, 2024
a087394
Fix build name
juliannguyen4 Jul 25, 2024
d6ea7f0
omit latest
juliannguyen4 Jul 25, 2024
8a29ff0
Change the build name to something valid
juliannguyen4 Jul 25, 2024
4d36873
Build number is required
juliannguyen4 Jul 25, 2024
9884fde
Be specific about build details
juliannguyen4 Jul 25, 2024
8cf5e64
fix
juliannguyen4 Jul 25, 2024
746a59c
Try another build number
juliannguyen4 Jul 25, 2024
8b6ce8a
Only look for artifacts in this repo
juliannguyen4 Jul 25, 2024
c53386a
Insert pattern first
juliannguyen4 Jul 25, 2024
5ca1672
Revert "Insert pattern first"
juliannguyen4 Jul 25, 2024
1ac7c3e
Revert "Only look for artifacts in this repo"
juliannguyen4 Jul 25, 2024
ac0869e
Add project
juliannguyen4 Jul 25, 2024
d6f5a2a
Specify project in filespec
juliannguyen4 Jul 30, 2024
3cbb96f
Add WIP compose.yml
juliannguyen4 Aug 1, 2024
d441d0d
Remove useless env
juliannguyen4 Aug 2, 2024
3629e9b
Run native server first
juliannguyen4 Aug 2, 2024
b07f420
Use default config file. Disable security
juliannguyen4 Aug 5, 2024
b4c8a7f
docker compose up
juliannguyen4 Aug 5, 2024
64992af
fix
juliannguyen4 Aug 5, 2024
6524ca7
debug
juliannguyen4 Aug 5, 2024
95e0dcf
debug
juliannguyen4 Aug 5, 2024
e2e1bc4
works?
juliannguyen4 Aug 5, 2024
8dd3583
whoop
juliannguyen4 Aug 5, 2024
c369aad
run detached
juliannguyen4 Aug 5, 2024
6646ff5
fix yq install
juliannguyen4 Aug 5, 2024
bfe1fca
check if containers are running
juliannguyen4 Aug 5, 2024
550bb6b
comment
juliannguyen4 Aug 5, 2024
8707206
comment
juliannguyen4 Aug 5, 2024
7349036
Use container ip address instead of localhost
juliannguyen4 Aug 5, 2024
3be5fe3
Clean up proxy client ci/cd code
juliannguyen4 Aug 9, 2024
29eec58
add missing todo
juliannguyen4 Aug 9, 2024
1102dc7
Merge branch 'stage-jdk8' into CLIENT-3033-proxy-client-cicd
juliannguyen4 Aug 9, 2024
9b8bff6
Use latest tag in compose file
juliannguyen4 Aug 9, 2024
b7c915f
Fix syntax
juliannguyen4 Aug 9, 2024
5d147ec
Fix logs
juliannguyen4 Aug 9, 2024
efa5164
setup-gpg
juliannguyen4 Aug 13, 2024
f28d70e
Setup gpg
juliannguyen4 Sep 5, 2024
4086a15
fix
juliannguyen4 Sep 5, 2024
648c31c
sign
juliannguyen4 Sep 5, 2024
23f8f8f
Merge remote-tracking branch 'origin/stage-jdk8' into CLIENT-3033-pro…
juliannguyen4 Sep 5, 2024
cf2e028
Just do the same as in asx
juliannguyen4 Sep 5, 2024
bab9a5f
Revert "Just do the same as in asx"
juliannguyen4 Sep 5, 2024
fac45e7
idk
juliannguyen4 Sep 5, 2024
47ef3e2
Fix
juliannguyen4 Sep 16, 2024
e6cc45b
Skip tests for now
juliannguyen4 Sep 16, 2024
1f54599
Add?
juliannguyen4 Sep 16, 2024
9cbcf4a
Merge remote-tracking branch 'origin/stage-jdk8' into CLIENT-3033-pro…
juliannguyen4 Sep 16, 2024
c24d00a
fix
juliannguyen4 Sep 16, 2024
ef27de9
Use passphrase from file
juliannguyen4 Sep 16, 2024
ba4b4ce
Use abs path
juliannguyen4 Sep 16, 2024
27af9ea
rm
juliannguyen4 Sep 17, 2024
ca7062d
Fix
juliannguyen4 Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 97 additions & 9 deletions .github/workflows/build-proxy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,113 @@
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-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/[email protected]
# mvn deploy
# - name: Set up settings.xml for Maven
# uses: s4u/[email protected]
# 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
8 changes: 8 additions & 0 deletions .github/workflows/releasebundle-filespec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"files": [
{
"pattern": "",
"project": "clients"
}
]
}
9 changes: 9 additions & 0 deletions .github/workflows/test-configs/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .github/workflows/test-configs/compose.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>8.1.4</version>
<version>8.1.4-SNAPSHOT</version>
</parent>
<artifactId>aerospike-benchmarks</artifactId>
<packaging>jar</packaging>
Expand Down
6 changes: 5 additions & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>8.1.4</version>
<version>8.1.4-SNAPSHOT</version>
</parent>
<artifactId>aerospike-client-jdk8</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -78,6 +78,10 @@
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>8.1.4</version>
<version>8.1.4-SNAPSHOT</version>
</parent>
<artifactId>aerospike-examples</artifactId>
<packaging>jar</packaging>
Expand Down
28 changes: 27 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<name>aerospike-parent</name>
<version>8.1.4</version>
<version>8.1.4-SNAPSHOT</version>
<packaging>pom</packaging>
<url>https://github.com/aerospike/aerospike-client-java</url>

Expand Down Expand Up @@ -138,6 +138,20 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
Expand Down Expand Up @@ -170,4 +184,16 @@
</repositories>
-->

<distributionManagement>
<repository>
<id>central</id>
<name>aerospike-artifactory-primary-0-releases</name>
<url>https://aerospike.jfrog.io/artifactory/clients-maven-dev-local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>aerospike-artifactory-primary-0-snapshots</name>
<url>https://aerospike.jfrog.io/artifactory/clients-maven-dev-local</url>
</snapshotRepository>
</distributionManagement>
</project>
8 changes: 7 additions & 1 deletion proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>8.1.4</version>
<version>8.1.4-SNAPSHOT</version>
</parent>
<artifactId>aerospike-proxy-client</artifactId>
<packaging>jar</packaging>
Expand All @@ -27,11 +27,13 @@

<dependency>
<groupId>io.grpc</groupId>
<version>${grpc.version}</version>
<artifactId>grpc-netty</artifactId>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<version>${netty.version}</version>
<artifactId>netty-transport</artifactId>
</dependency>

Expand Down Expand Up @@ -80,6 +82,10 @@
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>8.1.4</version>
<version>8.1.4-SNAPSHOT</version>
</parent>
<artifactId>aerospike-client-test</artifactId>
<packaging>jar</packaging>
Expand Down
5 changes: 3 additions & 2 deletions test/src/com/aerospike/test/SuiteAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

@RunWith(Suite.class)
@Suite.SuiteClasses({
SuiteSync.class,
SuiteAsync.class
// SuiteSync.class,
// SuiteAsync.class,
SuiteProxy.class
})
public class SuiteAll {
}
1 change: 1 addition & 0 deletions test/src/com/aerospike/test/SuiteProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading