From 63a977be1aed87e292229304618aebd9e09386d3 Mon Sep 17 00:00:00 2001 From: juliannguyen4 <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:09:18 -0700 Subject: [PATCH 1/4] [CLIENT-2510] CI/CD: Run build wheels workflow on any specific server version --- .github/actions/run-ee-server/action.yml | 7 +++++-- .github/workflows/build-wheels.yml | 14 +++++++++++--- Vagrantfile | 5 +++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/actions/run-ee-server/action.yml b/.github/actions/run-ee-server/action.yml index 732bc6d60..a901871ae 100644 --- a/.github/actions/run-ee-server/action.yml +++ b/.github/actions/run-ee-server/action.yml @@ -4,6 +4,9 @@ inputs: use-server-rc: required: true default: false + server-tag: + required: true + default: 'latest' runs: using: "composite" @@ -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 @@ -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 diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 08ff0f9c8..a80062d19 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -15,6 +15,12 @@ on: - release default: 'rc' required: true + # Test against a server version + # 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' jobs: update-version: @@ -145,6 +151,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 @@ -201,6 +208,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 @@ -408,7 +416,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: > @@ -455,11 +463,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 }} diff --git a/Vagrantfile b/Vagrantfile index 88f7ef33b..d17f1174f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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" From 7136984f00652ee0858fce9df049dc63b51bab82 Mon Sep 17 00:00:00 2001 From: juliannguyen4 <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:09:13 -0700 Subject: [PATCH 2/4] Move server tag input after first input --- .github/workflows/build-wheels.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4f7d2be91..c470c7a87 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -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 @@ -23,13 +30,6 @@ on: default: 'rc' required: true description: 'If bumping version, what type of bump?' - # Test against a server version - # 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' jobs: update-version: From 4e9d471dfbfd006ce3d337ee1159a99ed71e3a37 Mon Sep 17 00:00:00 2001 From: juliannguyen4 <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:15:03 -0700 Subject: [PATCH 3/4] Also print server tag --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index c470c7a87..8af462a8e 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -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: From 78e434444f77973e5bb8f7b01f8b565531b899a1 Mon Sep 17 00:00:00 2001 From: juliannguyen4 <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:48:25 -0700 Subject: [PATCH 4/4] Make workflow cancellable --- .github/workflows/build-wheels.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 8af462a8e..6254bf2d1 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -70,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 @@ -137,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: @@ -200,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: @@ -398,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: @@ -447,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: