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-2510] CI/CD: Add option to run on specific server version #507

Merged
merged 5 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/actions/run-ee-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
use-server-rc:
required: true
default: false
server-tag:
required: true
default: 'latest'

runs:
using: "composite"
Expand Down Expand Up @@ -36,7 +39,7 @@ runs:

- name: Get default aerospike.conf from Docker server EE container
run: |
docker run -d --name aerospike -p 3000-3002:3000-3002 $SERVER_IMAGE
docker run -d --name aerospike -p 3000-3002:3000-3002 $SERVER_IMAGE:${{ inputs.server-tag }}
sleep 5
docker cp aerospike:/etc/aerospike/aerospike.conf ./configs/aerospike.conf
docker container stop aerospike
Expand All @@ -50,7 +53,7 @@ runs:
shell: bash

- name: Run enterprise edition server
run: docker run -tid -v $(pwd)/configs:/opt/aerospike/etc -p 3000:3000 --name aerospike $SERVER_IMAGE asd --config-file /opt/aerospike/etc/aerospike.conf
run: docker run -tid -v $(pwd)/configs:/opt/aerospike/etc -p 3000:3000 --name aerospike $SERVER_IMAGE:${{ inputs.server-tag }} asd --config-file /opt/aerospike/etc/aerospike.conf
shell: bash

- name: Create user in database for tests
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build wheels
run-name: Build wheels (use-server-rc=${{ inputs.use-server-rc }}, should-bump-version=${{ inputs.should-bump-version }}, bump-rc-or-release=${{ inputs.bump-rc-or-release }})
run-name: Build wheels (use-server-rc=${{ inputs.use-server-rc }}, should-bump-version=${{ inputs.should-bump-version }}, bump-rc-or-release=${{ inputs.bump-rc-or-release }}, server-tag=${{ inputs.server-tag }})

# Builds wheels and optionally sends artifacts to Jfrog Artifactory
on:
Expand All @@ -10,6 +10,13 @@ on:
required: true
default: false
description: 'Test against server release candidate?'
# Override the default server version to test against
# This is helpful if you need to create a backport from an older client major version
# And that older client major version does not accomodate for breaking changes in the latest server version
server-tag:
required: true
default: 'latest'
description: 'Server docker image tag'
should-bump-version:
type: boolean
required: true
Expand Down Expand Up @@ -63,8 +70,10 @@ jobs:
build-sdist:
name: Build and install sdist
runs-on: ubuntu-latest
# Need to replace default success() condition because skipped job is not "successful"
# always() will cause this job to become uncancellable, so we check if current job hasn't been cancelled yet
# Run if update version workflow was skipped or succeeds
if: ${{ always() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
if: ${{ !cancelled() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
needs: update-version
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -130,7 +139,7 @@ jobs:
manylinux_arm64:
runs-on: ubuntu-latest
needs: update-version
if: ${{ always() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
if: ${{ !cancelled() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
strategy:
fail-fast: false
matrix:
Expand All @@ -157,6 +166,7 @@ jobs:
- uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}

- name: Set config.conf to use Docker IP address of Aerospike server
# config.conf should be copied into the cibuildwheel Docker container
Expand Down Expand Up @@ -192,7 +202,7 @@ jobs:
manylinux_x86_64:
runs-on: ubuntu-latest
needs: update-version
if: ${{ always() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
if: ${{ !cancelled() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
strategy:
fail-fast: false
matrix:
Expand All @@ -214,6 +224,7 @@ jobs:
- uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}

- name: Wait for server to start
run: sleep 5
Expand Down Expand Up @@ -389,7 +400,7 @@ jobs:

macOS-x86:
needs: update-version
if: ${{ always() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
if: ${{ !cancelled() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -422,7 +433,7 @@ jobs:
CIBW_ARCHS: "x86_64"
CIBW_BEFORE_TEST: >
export USE_SERVER_RC=${{ inputs.use-server-rc }} &&
vagrant up &&
SERVER_TAG=${{ inputs.server-tag }} vagrant up &&
sleep 3 &&
pip install -r test/requirements.txt
CIBW_TEST_COMMAND: >
Expand All @@ -438,7 +449,7 @@ jobs:
macOS-m1:
runs-on: [self-hosted, macOS, ARM64]
needs: update-version
if: ${{ always() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
if: ${{ !cancelled() && (needs.update-version.result == 'skipped' || needs.update-version.result == 'success') }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -470,11 +481,11 @@ jobs:

- name: Use server rc
if: ${{ inputs.use-server-rc }}
run: echo IMAGE_NAME="aerospike.jfrog.io/docker/aerospike/aerospike-server-rc:latest" >> $GITHUB_ENV
run: echo IMAGE_NAME="aerospike.jfrog.io/docker/aerospike/aerospike-server-rc:${{ inputs.server-tag }}" >> $GITHUB_ENV

- name: Use server release
if: ${{ !inputs.use-server-rc }}
run: echo IMAGE_NAME="aerospike/aerospike-server" >> $GITHUB_ENV
run: echo IMAGE_NAME="aerospike/aerospike-server:${{ inputs.server-tag }}" >> $GITHUB_ENV

- name: Run server
run: docker run -d -p 3000:3000 --name aerospike ${{ env.IMAGE_NAME }}
Expand Down
5 changes: 3 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ Vagrant.configure("2") do |config|
# SHELL

config.vm.provision "docker" do |d|
server_tag = ENV["SERVER_TAG"] || "latest"
if ENV["USE_SERVER_RC"] == "true"
$image_name = "aerospike.jfrog.io/docker/aerospike/aerospike-server-rc:latest"
$image_name = "aerospike.jfrog.io/docker/aerospike/aerospike-server-rc:#{server_tag}"
else
$image_name = "aerospike/aerospike-server:latest"
$image_name = "aerospike/aerospike-server:#{server_tag}"
end
d.run $image_name,
args: "-p 3000:3000"
Expand Down