Skip to content

Commit

Permalink
Added configuration to RC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzakaracic committed Dec 31, 2024
1 parent 9ba4e7e commit 4d9d4be
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 89 deletions.
14 changes: 7 additions & 7 deletions .github/actions/build-and-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ inputs:
required: false
default: "latest"
description: "Server docker image tag"
jfrog-docker-username:
oidc-provider:
required: true
description: ""
jfrog-docker-token:
oidc-audience:
required: true
description: ""
run-tests:
required: true
default: "false"
default: "true"
description: Spin up aerospike enterprise server and run tests

runs:
Expand All @@ -39,17 +39,17 @@ runs:
shell: bash
run: mvn clean install

- name: Run EE server
- name: Run Aerospike
if: ${{ inputs.run-tests == 'true' }}
uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
docker-hub-username: ${{ inputs.jfrog-docker-username }}
docker-hub-password: ${{ inputs.jfrog-docker-token }}
oidc-provider: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}

- name: Run tests
shell: bash
if: ${{ inputs.run-tests == true }}
if: ${{ inputs.run-tests == 'true' }}
working-directory: test
run: mvn test -DskipTests=false
42 changes: 26 additions & 16 deletions .github/actions/publish-to-sonatype/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ name: Publish artifacts to Sonatype
description: "Publishes artifacts to Sonatype"

inputs:
jfrog-releases-repo-name:
description: ""
required: false
default: clients-maven-dev-local
jfrog-snapshots-repo-name:
description: ""
required: false
default: clients-maven-dev-local
jfrog-platform-url:
description: ""
required: false
Expand All @@ -20,12 +12,6 @@ inputs:
oidc-audience:
description: ""
required: true
artifact-name:
description: ""
required: true
artifact-version:
description: ""
required: true
staging-folder:
description: ""
required: false
Expand All @@ -34,6 +20,12 @@ inputs:
description: ""
required: false
default: clients-maven-stage-local
build-name-number:
description: ""
required: true
artifact-version:
description: ""
required: true

runs:
using: "composite"
Expand All @@ -48,6 +40,24 @@ runs:
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}

- name: Get info
shell: bash
id: get-build-info
run: |
INPUT=${{ inputs.build-name-number }}
BUILD_NAME="${INPUT%/*}" # Getting the build name
BUILD_NUMBER="${INPUT#*/}" # Getting build number
BUILD_INFO=$(jf rt curl "/api/build/${BUILD_NAME}/${BUILD_NUMBER}")
echo "build-info=${BUILD_INFO}" >> $GITHUB_OUTPUT
- name: Get build name
shell: bash
id: get-build-name
run: |
echo build-name=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.modules[].id | sub("/[0-9]+$"; "")') >> $GITHUB_OUTPUT
- name: Create staging folder
shell: bash
run: |
Expand All @@ -57,10 +67,10 @@ runs:
shell: bash
working-directory: ${{ inputs.staging-folder }}
run: |
jf rt dl "${{ inputs.target-repository }}/com/aerospike/${{ inputs.artifact-name }}/${{ inputs.artifact-version }}/*" .
jf rt dl "${{ inputs.target-repository }}/com/aerospike/${{ steps.get-build-name.build-name }}/${{ inputs.artifact-version }}/*" .
- name: Debug list downloaded content
shell: bash
working-directory: ${{ inputs.staging-folder }}
run: |
ls -la
ls -laR
35 changes: 27 additions & 8 deletions .github/actions/run-ee-server/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,57 @@ inputs:
required: false
description: Container repo url
default: aerospike.jfrog.io/docker/
oidc-provider:
jfrog-platform-url:
description: ""
required: false
default: gh-aerospike-clients
default: https://aerospike.jfrog.io
oidc-provider:
description: ""
required: true
oidc-audience:
description: ""
required: true
container-name:
default: aerospike
required: false
default: aerospike/clients
description: Name for test container

runs:
using: "composite"
steps:
- name: Set up JFrog credentials
id: setup-jfrog-cli
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ inputs.jfrog-platform-url }}
with:
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}

- name: Log into Docker Hub to get server RC
if: ${{ inputs.use-server-rc == 'true' }}
run: docker login ${{ inputs.container-repo-url }} --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
- if: ${{ inputs.use-server-rc == 'true' }}
run: docker login ${{ inputs.container-repo-url }} --username ${{ steps.setup-jfrog-cli.outputs.oidc-user }} --password ${{ steps.setup-jfrog-cli.outputs.oidc-token }}
shell: bash

- run: echo IMAGE_NAME=${{ inputs.use-server-rc == 'true' && inputs.container-repo-url || '' }}aerospike/aerospike-server-enterprise${{ inputs.use-server-rc == 'true' && '-rc' || '' }}:${{ inputs.server-tag }} >> $GITHUB_ENV
shell: bash

- run: docker run -d --name aerospike -p 3000:3000 ${{ env.IMAGE_NAME }}
- run: docker run -d --name ${{ inputs.container-name }} -p 3000:3000 ${{ env.IMAGE_NAME }}
shell: bash

- uses: ./.github/actions/wait-for-as-server-to-start
with:
container-name: aerospike
container-name: ${{ inputs.container-name }}
is-security-enabled: true
is-strong-consistency-enabled: true

- run: docker exec ${{ inputs.container-name }} asadm --enable -e 'asinfo -v "roster-set:namespace=test;nodes=A1"'
shell: bash

- run: docker exec ${{ inputs.container-name }} asadm --enable -e 'asinfo -v revive:'
shell: bash

- run: docker exec ${{ inputs.container-name }} asadm --enable -e 'asinfo -v recluster:'
shell: bash

- run: docker logs ${{ inputs.container-name }}
shell: bash
6 changes: 5 additions & 1 deletion .github/actions/wait-for-as-server-to-start/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
description: Flag to toggle docker hub creds use. With this flag enabled before attempting to pull image we will attempt to log in do docker hub.
required: false
default: "false"
is-strong-consistency-enabled:
description: Flag to enable strong consistency
required: false
default: "false"

runs:
using: "composite"
Expand All @@ -18,5 +22,5 @@ runs:
# Also, we don't want to fail if we timeout in case the server *did* finish starting up but the script couldn't detect it due to a bug
# Effectively, this composite action is like calling "sleep" that is optimized to exit early when it detects an ok from the server
- name: Wait for EE server to start
run: timeout 30 bash ./.github/workflows/scripts/wait-for-as-server-to-start.sh ${{ inputs.container-name }} ${{ inputs.is-security-enabled }} || true
run: timeout 30 bash ./.github/workflows/scripts/wait-for-as-server-to-start.sh ${{ inputs.container-name }} ${{ inputs.is-security-enabled }} ${{ inputs.is-strong-consistency-enabled }} || true
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/aggregate-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
steps:
- name: Set up JFrog credentials l
id: setup-jfrog-cli
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,8 @@ on:
description: Spin up aerospike enterprise server and run tests

jobs:
debug-job:
runs-on: ubuntu-latest
steps:
- name: debug
run: |
echo "${{ inputs.branch }}"
echo "${{ github.base_ref }}"
java-version:
needs: debug-job
runs-on: ubuntu-latest
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
outputs:
java-version: ${{ steps.get-java-version.outputs.java-version }}
steps:
Expand All @@ -62,14 +53,6 @@ jobs:
run: |
echo ${{ steps.get-java-version.outputs.java-version }}
debug-java-version-job:
runs-on: ubuntu-latest
needs: java-version
steps:
- name: debug
run: |
echo "${{ needs.java-version.outputs.java-version }}"
build:
uses: ./.github/workflows/build.yaml
needs: java-version
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -58,22 +58,11 @@ jobs:
distribution: "semeru" # See 'Supported distributions' for available options
java-version: ${{ inputs.java-version }}

# This is needed so we can authenticate and get the credentials to be able to pull AE RC from JFrog
- name: Set up JFrog credentials
id: setup-jfrog-cli
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ inputs.jfrog-platform-url }}
with:
version: 2.72.2
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}

- name: Build and test
uses: ./.github/actions/build-and-test
with:
crypto-type: ${{ inputs.crypto-type }}
server-tag: ${{ inputs.server-tag }}
use-server-rc: ${{ inputs.use-server-rc }}
jfrog-docker-username: ${{ steps.setup-jfrog-cli.outputs.oidc-user }}
jfrog-docker-token: ${{ steps.setup-jfrog-cli.outputs.oidc-token }}
oidc-provider: ${{ secrets.JFROG_OIDC_PROVIDER }}
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }}
46 changes: 27 additions & 19 deletions .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ on:
required: true

jobs:
validate-build:
runs-on: ubuntu-latest
promote:
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
outputs:
build-name-numbers: ${{ steps.get-build-name-number.outputs.build-name-numbers }}
artifact-version: ${{ steps.get-artifact-version.outputs.artifact-version }}
steps:
- name: Setup jfrog shell
uses: jfrog/setup-jfrog-cli@v4
Expand Down Expand Up @@ -91,29 +94,34 @@ jobs:
jf rt build-promote "$BUILD_NAME" ${{ inputs.build-number }} ${{ inputs.target-repository }}
done
- name: Get build name with build number
id: get-build-name-number
run: |
echo "build-name-numbers=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq '[.buildInfo.modules[].id]')" >> $GITHUB_OUTPUT
- name: Get artifact version
id: get-artifact-version
working-directory: client
working-directory: client # The version will be the same for all the modules in the project. Taking client since this is the module that is released.
run: |
echo artifact-version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_OUTPUT
echo "artifact-version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Get artifact name
id: get-artifact-name
working-directory: client
- name: Build name
run: |
echo artifact-name=$(mvn help:evaluate -Dexpression=project.build.finalName -q -DforceStdout) >> $GITHUB_OUTPUT
#- name: Create GitHub release
# uses: ./.github/actions/github-release
# with:
# artifact-version: ${{ steps.get-artifact-version.outputs.artifact-version }}
# github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to Sonatype (Maven central)
uses: ./.github/actions/publish-to-sonatype
echo "build-name-number: ${{ steps.get-build-name-number.outputs.build-name-number }}"
echo "artifact-version: ${{ steps.get-artifact-version.output.artifact-version }}"
publish-to-sonatype:
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
needs: promote
strategy:
matrix:
build-name-number: ${{ needs.promote.outputs.build-name-numbers }}
artifact-version: ${{ needs.promote.outputs.artifact-version }}
steps:
- uses: ./.github/actions/publish-to-sonatype
with:
oidc-provider: ${{ secrets.JFROG_OIDC_PROVIDER }}
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }}
artifact-name: ${{ steps.get-artifact-name.outputs.artifact-name }}
artifact-version: ${{ steps.get-artifact-version.outputs.artifact-version }}
target-repository: ${{ inputs.target-repository }}
build-name-number: ${{ matrix.build-name-number }}
artifact-version: ${{ matrix.artifact-version }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
test-with-server-release:
name: Build stage - Test with latest version of Aerospike Enterprise Server
uses: ./.github/workflows/build-dev.yaml
uses: ./.github/workflows/build-pr.yaml
with:
branch: ${{ github.ref }}
source-branch: ${{ inputs.source-branch || github.base_ref }}
Expand All @@ -26,7 +26,7 @@ jobs:

test-with-server-rc:
name: Build stage - Test with latest RC version of Aerospike Enterprise Server
uses: ./.github/workflows/build-dev.yaml
uses: ./.github/workflows/build-pr.yaml
with:
branch: ${{ github.base_ref || inputs.branch }}
source-branch: ${{ inputs.source-branch || github.base_ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
debug-job:
runs-on: ubuntu-latest
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
steps:
- name: debug
run: |
Expand All @@ -16,7 +16,7 @@ jobs:
java-version:
needs: debug-job
runs-on: ubuntu-latest
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
outputs:
java-version: ${{ steps.get-java-version.outputs.java-version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.BUILD_CONTAINER_DISTRO_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit 4d9d4be

Please sign in to comment.