diff --git a/.github/actions/run-ee-server/action.yml b/.github/actions/run-ee-server/action.yml index 7df417e5e0..bf844dbeb8 100644 --- a/.github/actions/run-ee-server/action.yml +++ b/.github/actions/run-ee-server/action.yml @@ -11,7 +11,7 @@ inputs: server-tag: required: true description: Specify Docker tag - default: 'latest' + default: latest # Github Composite Actions can't access secrets # so we need to pass them in as inputs docker-hub-username: @@ -24,6 +24,9 @@ inputs: required: false description: 'docker-host, separate-docker-container, "remote-connection" via DOCKER_HOST' default: 'docker-host' + GITHUB_TOKEN: + required: true + description: GITHUB_TOKEN runs: using: "composite" @@ -38,12 +41,18 @@ runs: - run: echo IMAGE_NAME=aerospike/aerospike-server-enterprise${{ inputs.use-server-rc == 'true' && '-rc' || '' }}:${{ inputs.server-tag }} >> $GITHUB_ENV shell: bash - - run: echo NEW_IMAGE_NAME=${{ env.IMAGE_NAME }}-python-client-testing >> $GITHUB_ENV + - run: docker pull $IMAGE_NAME + shell: bash + + - run: echo REGISTRY=ghcr.io >> $GITHUB_ENV + shell: bash + + - run: echo NEW_IMAGE_NAME=${{ env.REGISTRY }}/aerospike/aerospike-server-enterprise-python-client-testing >> $GITHUB_ENV shell: bash # macOS Github runners and Windows self-hosted runners don't have buildx installed by default - - if: ${{ runner.os == 'Windows' || runner.os == 'macOS' }} - uses: docker/setup-buildx-action@v3 + # Also we want to use the docker-container driver so we can cache our custom server image + - uses: docker/setup-buildx-action@v3 - run: echo CA_CERT_FILE_NAME="ca.cer" >> $GITHUB_ENV shell: bash @@ -51,6 +60,12 @@ runs: - run: echo TLS_PORT="4333" >> $GITHUB_ENV shell: bash + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ inputs.GITHUB_TOKEN }} + - name: Build Aerospike server Docker image for testing # We enable TLS standard authentication to verify that the OpenSSL library bundled with the wheel works # You can manually verify this by enabling debug logging in the client and checking that the server certificate was verified @@ -61,16 +76,18 @@ runs: build-args: | SERVER_IMAGE=${{ env.IMAGE_NAME }} TLS_PORT=${{ env.TLS_PORT }} - tags: ${{ env.NEW_IMAGE_NAME }} - # setup-buildx-action configures Docker to use the docker-container build driver - # This driver doesn't publish an image locally by default + tags: ${{ env.NEW_IMAGE_NAME }}:${{ inputs.server-tag }} + # the docker-container driver doesn't publish an image locally by default # so we have to manually enable it - load: true + push: true + # Also cache image so we don't have to rebuild it every time we use this action + cache-from: type=registry,ref=${{ env.NEW_IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.NEW_IMAGE_NAME }}:buildcache,mode=max - run: echo SERVER_CONTAINER_NAME="aerospike" >> $GITHUB_ENV shell: bash - - run: docker run -d --name ${{ env.SERVER_CONTAINER_NAME }} -p 3000:3000 -p ${{ env.TLS_PORT }}:${{ env.TLS_PORT }} ${{ env.NEW_IMAGE_NAME }} + - run: docker run -d --name ${{ env.SERVER_CONTAINER_NAME }} -p 3000:3000 -p ${{ env.TLS_PORT }}:${{ env.TLS_PORT }} ${{ env.NEW_IMAGE_NAME }}:${{ inputs.server-tag }} shell: bash - name: 'macOS: install timeout command' diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 7424e99f22..1acfef1952 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -206,6 +206,7 @@ jobs: docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} where-is-client-connecting-from: ${{ inputs.platform-tag == 'macosx_x86_64' && 'docker-host' || 'separate-docker-container' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: If not running tests against server, only run basic import test if: ${{ env.RUN_INTEGRATION_TESTS_IN_CIBW == 'false' }} @@ -377,6 +378,7 @@ jobs: docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} where-is-client-connecting-from: ${{ inputs.platform-tag == 'win_amd64' && 'remote-connection' || 'docker-host' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Download wheel uses: actions/download-artifact@v4 diff --git a/.github/workflows/docker-build-context/Dockerfile b/.github/workflows/docker-build-context/Dockerfile index 05a8e6f4c6..90f0baec65 100644 --- a/.github/workflows/docker-build-context/Dockerfile +++ b/.github/workflows/docker-build-context/Dockerfile @@ -81,6 +81,8 @@ EXPOSE $TLS_PORT FROM ubuntu:24.04 AS dos2unix # Run our own set up steps after server finishes starting up +# Running WORKDIR on an existing directory causes WORKDIR instruction to not be cached +RUN mkdir /my-scripts WORKDIR /my-scripts COPY entrypoint-finalize-setup.bash wait-for-as-server-to-start.bash . # Both Github Actions and the entrypoint script can reuse this wait script diff --git a/.github/workflows/stage-tests.yml b/.github/workflows/stage-tests.yml index 935fc14376..d0a02d7b06 100644 --- a/.github/workflows/stage-tests.yml +++ b/.github/workflows/stage-tests.yml @@ -110,6 +110,7 @@ jobs: docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} where-is-client-connecting-from: 'separate-docker-container' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run distro container # Run distro container on host network to access the Aerospike server using localhost (without having to change config.conf) @@ -211,6 +212,7 @@ jobs: docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} where-is-client-connecting-from: 'docker-host' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install wheel run: python3 -m pip install *.whl diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cef8d86b96..3f8f5ba723 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -122,6 +122,7 @@ jobs: use-server-rc: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }} docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: python3 -m pytest --cov=aerospike_helpers --cov-report xml:coverage.xml ./new_tests working-directory: test @@ -298,6 +299,7 @@ jobs: use-server-rc: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }} docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run tests # We need to disable capturing output or else we cannot see memory errors reported by @@ -433,6 +435,7 @@ jobs: use-server-rc: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }} docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run tests run: python -m pytest ./new_tests/test_{mrt_functionality,admin_*,compress}.py -W error::pytest.PytestUnraisableExceptionWarning diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 74109371fe..cdf897eee1 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -151,6 +151,7 @@ jobs: server-tag: ${{ inputs.server-tag }} docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: sudo apt update - run: sudo apt install valgrind -y