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

Delete dev-workflow-p2.yml #643

Open
wants to merge 42 commits into
base: dev-CICD
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fe74d74
Delete dev-workflow-p2.yml
DomPeliniAerospike Nov 16, 2024
f181bb1
Pipeline improvements
DomPeliniAerospike Nov 20, 2024
2c78b41
Update dev-workflow-p1.yml
DomPeliniAerospike Nov 20, 2024
ee79465
Update test-server-rc.yml
DomPeliniAerospike Nov 20, 2024
da4b02c
Update build-bindings.yml
DomPeliniAerospike Nov 20, 2024
ae2236d
Update build-artifacts.yml
DomPeliniAerospike Nov 20, 2024
9969f5a
Update action.yml
DomPeliniAerospike Nov 20, 2024
302138f
pipeline improvements
DomPeliniAerospike Nov 20, 2024
0e402c5
pipeline improvmements
DomPeliniAerospike Nov 20, 2024
3ff3b1e
Update action.yml
DomPeliniAerospike Nov 20, 2024
054face
Create Dockerfile
DomPeliniAerospike Nov 20, 2024
839dbac
Revert "Create Dockerfile"
DomPeliniAerospike Nov 20, 2024
1c8b588
Create Dockerfile
DomPeliniAerospike Nov 20, 2024
302982a
Create security.smd
DomPeliniAerospike Nov 20, 2024
6ba7676
Create action.yml
DomPeliniAerospike Nov 20, 2024
29a088b
Create wait-for-as-server-to-start.bash
DomPeliniAerospike Nov 21, 2024
3b6c77f
Update action.yml
DomPeliniAerospike Nov 21, 2024
34d2695
Update action.yml
DomPeliniAerospike Nov 21, 2024
1e835f2
Update action.yml
DomPeliniAerospike Nov 21, 2024
1685deb
Update action.yml
DomPeliniAerospike Nov 21, 2024
394e125
Update action.yml
DomPeliniAerospike Nov 21, 2024
545831c
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
160c3d2
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
4409ccc
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
e58f0b6
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
dabab29
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
405d40d
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
8c5b8a1
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
af5a871
Update batch_write.ts
DomPeliniAerospike Nov 21, 2024
23bce37
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
611046c
Update build-bindings.yml
DomPeliniAerospike Nov 21, 2024
615480b
Pipeline improvements
DomPeliniAerospike Nov 21, 2024
2551d4c
improved pipeline
DomPeliniAerospike Nov 21, 2024
4b0808f
pipeline improvement
DomPeliniAerospike Nov 22, 2024
cf38891
pipeline improvements
DomPeliniAerospike Nov 22, 2024
d9afd79
Update action.yml
DomPeliniAerospike Nov 22, 2024
f570046
Update action.yml
DomPeliniAerospike Nov 22, 2024
d8db173
Update action.yml
DomPeliniAerospike Nov 22, 2024
aa20ba6
Update action.yml
DomPeliniAerospike Nov 22, 2024
5430720
Pipeline improvements
DomPeliniAerospike Dec 4, 2024
a8ff6d0
Pipeline improvements
DomPeliniAerospike Dec 4, 2024
7c0167a
Pipeline improvements
DomPeliniAerospike Dec 4, 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
40 changes: 40 additions & 0 deletions .github/actions/run-ee-server-for-ext-container/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Run EE server for another Docker container'
description: 'Run EE server and configure tests to connect to it from another Docker container'
inputs:
# All inputs in composite actions are strings
use-server-rc:
required: true
default: false
server-tag:
required: true
default: 'latest'
# Github Composite Actions can't access secrets
# so we need to pass them in as inputs
docker-hub-username:
required: false
docker-hub-password:
required: false

runs:
using: "composite"
steps:
- name: Run EE server
uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
docker-hub-username: ${{ inputs.docker-hub-username }}
docker-hub-password: ${{ inputs.docker-hub-password }}

- name: Get IP address of Docker container hosting server
id: get-server-ip-address
run: echo server-ip=$(docker container inspect -f '{{ .NetworkSettings.IPAddress }}' aerospike) >> $GITHUB_OUTPUT
shell: bash

- name: Configure tests to connect to that Docker container
run: |
pipx install crudini --pip-args "-c ${{ github.workspace }}/.github/workflows/requirements.txt";
crudini --existing=param --set config.conf enterprise-edition hosts ${{ steps.get-server-ip-address.outputs.server-ip }}:3000;
cat config.conf
working-directory: .github/workflows
shell: bash
98 changes: 72 additions & 26 deletions .github/actions/run-ee-server/action.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,108 @@
name: 'Run EE Server'
description: 'Run EE server'
description: 'Run EE server. Returns once server is ready. Only tested on Linux and macOS'
# NOTE: do not share this server container with others
# since it's using the default admin / admin credentials
inputs:
# All inputs in composite actions are strings
use-server-rc:
required: true
default: false
description: Deploy server release candidate?
default: 'false'
server-tag:
required: true
description: Specify Docker tag

default: 'latest'
# Github Composite Actions can't access secrets
# so we need to pass them in as inputs
docker-hub-username:
description: Required for using release candidates
required: false
docker-hub-password:
description: Required for using release candidates
required: false

runs:
using: "composite"
steps:
- name: Create config folder to store configs in
run: mkdir configs
- name: Install crudini to manipulate config.conf
# This will only work on the Github hosted runners.
run: pipx install crudini --pip-args "-c ${{ github.workspace }}/.github/workflows/requirements.txt"
working-directory: .github/workflows
shell: bash

- name: Use release server
if: ${{ inputs.use-server-rc == 'false' }}
run: echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise" >> $GITHUB_ENV
- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: .github/workflows
shell: bash

- name: Use release candidate server
if: ${{ inputs.use-server-rc == 'true' }}
run: echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise-rc" >> $GITHUB_ENV
- name: Use enterprise edition instead of community edition in config.conf
run: |
crudini --existing=param --set config.conf enterprise-edition hosts ''
crudini --existing=param --set config.conf enterprise-edition hosts 127.0.0.1:3000
working-directory: .github/workflows
shell: bash

- run: echo SUPERUSER_NAME_AND_PASSWORD="superuser" >> $GITHUB_ENV
shell: bash

- name: Set credentials in config file
run: |
crudini --existing=param --set config.conf enterprise-edition user ${{ env.SUPERUSER_NAME_AND_PASSWORD }}
crudini --existing=param --set config.conf enterprise-edition password ${{ env.SUPERUSER_NAME_AND_PASSWORD }}
working-directory: .github/workflows
shell: bash

- name: Log into Docker Hub to get server RC
if: ${{ inputs.use-server-rc == 'true' }}
run: docker login --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
shell: bash

- name: Get default aerospike.conf from Docker server EE container
run: |
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
docker container rm aerospike
- 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 }}-security-and-sc >> $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

- name: Build and push
uses: docker/build-push-action@v6
with:
# Don't want to use default Git context or else it will clone the whole Python client repo again
context: .github/workflows/docker-build-context
build-args: |
server_image=${{ env.IMAGE_NAME }}
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
# so we have to manually enable it
load: true

- run: echo SERVER_CONTAINER_NAME="aerospike" >> $GITHUB_ENV
shell: bash

- run: docker run -d --name ${{ env.SERVER_CONTAINER_NAME }} -e DEFAULT_TTL=2592000 -p 3000:3000 ${{ env.NEW_IMAGE_NAME }}
shell: bash

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

- run: echo ASADM_AUTH_FLAGS="--user=${{ env.SUPERUSER_NAME_AND_PASSWORD }} --password=${{ env.SUPERUSER_NAME_AND_PASSWORD }}" >> $GITHUB_ENV
shell: bash

- name: Enable security features using aerospike.conf
# Security stanza
run: echo -e "security {\n\tenable-quotas true\n}\n" >> ./aerospike.conf
working-directory: ./configs
# All the partitions are assumed to be dead when reusing a roster file
- run: docker exec ${{ env.SERVER_CONTAINER_NAME }} asadm $ASADM_AUTH_FLAGS --enable --execute "manage revive ns test"
shell: bash

- name: Run enterprise edition server
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
# Apply changes
- run: docker exec ${{ env.SERVER_CONTAINER_NAME }} asadm $ASADM_AUTH_FLAGS --enable --execute "manage recluster"
shell: bash

- name: Create user in database for tests
# Use default admin user to create another user for testing
run: docker exec aerospike asadm --user admin --password admin --enable -e "manage acl create user superuser password superuser roles read-write-udf sys-admin user-admin data-admin"
# For debugging
- run: docker logs aerospike
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/update-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ runs:
using: "composite"
steps:
- name: Update VERSION metadata
run: echo ${{ inputs.new_version }} > VERSION
run: npm version ${{ inputs.new_version }} --no-git-tag-version
shell: bash
28 changes: 28 additions & 0 deletions .github/actions/wait-for-as-server-to-start/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Wait for Aerospike server to start'
description: Only tested on Linux and macOS
inputs:
container-name:
required: true
is-security-enabled:
required: false
default: 'false'
is-strong-consistency-enabled:
required: false
default: 'false'

runs:
using: "composite"
steps:
- name: 'macOS: install timeout command'
if: ${{ runner.os == 'macOS' }}
run: brew install coreutils
shell: bash

# Composite actions doesn't support step-level timeout-minutes
# Use timeout command and store polling logic in file to make it easier to read
# Call bash shell explicitly since timeout uses "sh" shell by default, for some reason
# 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/wait-for-as-server-to-start.bash ${{ inputs.container-name }} ${{ inputs.is-security-enabled }} ${{ inputs.is-strong-consistency-enabled }} || true
shell: bash
10 changes: 10 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG image
FROM $image
RUN echo -e "security {\n\tenable-quotas true\n}\n" >> /etc/aerospike/aerospike.template.conf
# security.smd was generated manually by
# 1. Starting a new Aerospike EE server using Docker
# 2. Creating the superuser user
# 3. Copying /opt/aerospike/smd/security.smd from the container and committing it to this repo
# This file should always work
# TODO: generate this automatically, somehow
COPY security.smd /opt/aerospike/smd/
6 changes: 3 additions & 3 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ jobs:
matrix:
platform-tag: [
"manylinux_x86_64",
"manylinux_aarch64",
#"manylinux_aarch64",
"macosx_x86_64",
"macosx_arm64",
"win_amd64"
#"macosx_arm64",
#"win_amd64"
]
fail-fast: false
uses: ./.github/workflows/build-bindings.yml
Expand Down
59 changes: 45 additions & 14 deletions .github/workflows/build-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ on:
required: true
options:
- manylinux_x86_64
- manylinux_aarch64
#- manylinux_aarch64
- macosx_x86_64
- macosx_arm64
- win_amd64
#- macosx_arm64
#- win_amd64
# Makes debugging via gh cli easier.
default: manylinux_x86_64
unoptimized:
Expand Down Expand Up @@ -65,6 +65,10 @@ on:
required: true
default: 'latest'
description: 'Server docker image tag'
test-file:
required: false
default: ''
description: 'new_tests/<value>'

workflow_call:
inputs:
Expand Down Expand Up @@ -106,6 +110,10 @@ on:
type: string
default: 'latest'
description: 'Server docker image tag'
test-file:
required: false
type: string
default: ''
secrets:
# Just make all the secrets required to make things simpler...
DOCKER_HUB_BOT_USERNAME:
Expand Down Expand Up @@ -184,7 +192,7 @@ jobs:

- name: 'macOS x86: run Aerospike server in Docker container and connect via localhost'
if: ${{ env.RUN_INTEGRATION_TESTS_IN_CIBW == 'true' && inputs.platform-tag == 'macosx_x86_64' }}
uses: ./.github/actions/run-ee-server
uses: ./.github/actions/run-ee-server-for-ext-container
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
Expand Down Expand Up @@ -212,14 +220,14 @@ jobs:
# run: echo "TEST_COMMAND=python -c \"import aerospike\"" >> $GITHUB_ENV
# shell: bash

- name: Otherwise, enable integration tests
if: ${{ env.RUN_INTEGRATION_TESTS_IN_CIBW == 'true' }}
run: echo "TEST_COMMAND=cd ts-test;
npm install typescript --save-dev;
npx tsc;
cd ..;
npm run test dist/ -- --h 127.0.0.1 --port 3000" >> $GITHUB_ENV
shell: bash
#- name: Otherwise, enable integration tests
# if: ${{ env.RUN_INTEGRATION_TESTS_IN_CIBW == 'true' }}
# run: echo "TEST_COMMAND=cd ts-test;
# npm install typescript --save-dev;
# npx tsc;
# cd ..;
# npm run test dist/ -- --h 127.0.0.1 --port 3000" >> $GITHUB_ENV
# shell: bash

- name: Set unoptimize flag
if: ${{ inputs.unoptimized && (startsWith(inputs.platform-tag, 'manylinux') || startsWith(inputs.platform-tag, 'macosx')) }}
Expand All @@ -234,6 +242,29 @@ jobs:
./scripts/build-c-client.sh;
npm install;


- name: Run tests
if: ${{ inputs.run_tests && inputs.platform-tag == 'manylinux_x86_64'}}
run: |
docker ps;
docker logs aerospike;
cd ts-test;
npm install typescript --save-dev;
npx tsc;
cd ..;
npm run test dist/${{ inputs.test-file }} -- --h 172.17.0.2 --port 3000 --U superuser --P superuser;

- name: Run tests
if: ${{ inputs.run_tests && inputs.platform-tag == 'macosx_x86_64'}}
run: |
docker ps;
docker logs aerospike;
cd ts-test;
npm install typescript --save-dev;
npx tsc;
cd ..;
npm run test dist/${{ inputs.test-file }} -- --h localhost --port 3000 --U superuser --P superuser;

# NEED TO MAKE A NODEJS ACTION WHICH REPLACES THIS!!!
#- name: Build wheel
# uses: pypa/[email protected]
Expand Down Expand Up @@ -334,7 +365,7 @@ jobs:
run: |
$env:DOCKER_HOST_IP = $env:DOCKER_HOST | foreach {$_.replace("tcp://","")} | foreach {$_.replace(":2375", "")}
crudini --set config.conf enterprise-edition hosts ${env:DOCKER_HOST_IP}:3000
working-directory: test
working-directory: ./github/workflows

# FIGURE OUT WHAT SETUP NEEDS TO HAPPEN
- run: |
Expand All @@ -347,7 +378,7 @@ jobs:
- run: npx tsc
shell: bash

- run: npm run test dist/ -- --h 127.0.0.1 --port 3000
- run: npm run test dist/ -- --h ${env:DOCKER_HOST_IP} --port 3000
shell: bash

- name: Show job status for commit
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/bump-dev-num.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const semver = require('semver');

const versionString = process.argv[2];
let version = semver.parse(versionString);

if (!version) {
console.error("Invalid version string");
process.exit(1);
}

if (version.prerelease.includes('dev')) {
// Increment the dev release number
version.inc('prerelease', 'dev');
} else if (version.prerelease.includes('rc')) {
// Increment the RC number
version.inc('prerelease', 'rc');
version.prerelease[1] = 1; // Ensure dev number starts at 1
} else {
// Assume this is a release version
version.inc('minor'); // Bump to next minor version
version.prerelease = ['rc', 1]; // Start RC numbers from 1
version.format(); // Apply changes
}

console.log(version.version);
Loading
Loading