Skip to content
Draft
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
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
env: {
node: true,
es6: true,
jest: true,
},
ignorePatterns: [
'node_modules/',
'build/',
'dist/',
'*.js',
],
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
};
17 changes: 17 additions & 0 deletions .github/actions/setup-smithy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Setup Smithy CLI'
description: 'Install Smithy CLI for building the project'

runs:
using: 'composite'
steps:
- name: Install Smithy CLI
shell: bash
env:
SMITHY_VERSION: '1.61.0'
run: |
mkdir -p smithy-install/smithy
curl -L https://github.com/smithy-lang/smithy/releases/download/${SMITHY_VERSION}/smithy-cli-linux-x86_64.zip -o smithy-install/smithy-cli-linux-x86_64.zip
unzip -qo smithy-install/smithy-cli-linux-x86_64.zip -d smithy-install
mv smithy-install/smithy-cli-linux-x86_64/* smithy-install/smithy
sudo smithy-install/smithy/install
smithy --version
22 changes: 22 additions & 0 deletions .github/docker-compose.cloudserver-metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
metadata-standalone:
image: ghcr.io/scality/metadata:8.11.0-standalone
platform: linux/amd64
network_mode: 'host'
volumes:
- ./md-config.json:/mnt/standalone_workdir/config.json:ro

cloudserver-metadata:
image: ghcr.io/scality/cloudserver:9.1.4
platform: linux/amd64
network_mode: 'host'
environment:
- S3VAULT=mem
- S3METADATA=scality
- S3DATA=mem
- REMOTE_MANAGEMENT_DISABLE=true
- SCALITY_ACCESS_KEY_ID=accessKey1
- SCALITY_SECRET_ACCESS_KEY=verySecretKey1
- LOG_LEVEL=info
depends_on:
- metadata-standalone
48 changes: 48 additions & 0 deletions .github/docker-compose.cloudserver-mongo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
mongodb:
image: mongo:5.0
platform: linux/amd64
command: --replSet rs0 --port 27018 --bind_ip_all
ports:
- "27018:27018"
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh --port 27018 --quiet
interval: 5s
timeout: 10s
retries: 5
start_period: 10s

mongo-init:
image: mongo:5.0
platform: linux/amd64
depends_on:
mongodb:
condition: service_healthy
command: >
mongosh --host mongodb:27018 --eval
'rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb:27018"}]})'
restart: "no"

cloudserver:
image: ghcr.io/scality/cloudserver:9.1.4
platform: linux/amd64
ports:
- "8000:8000"
environment:
- S3VAULT=mem
- S3METADATA=mongodb
- S3DATA=mem
- MONGODB_HOSTS=mongodb:27018
- MONGODB_RS=rs0
- REMOTE_MANAGEMENT_DISABLE=true
- SCALITY_ACCESS_KEY_ID=accessKey1
- SCALITY_SECRET_ACCESS_KEY=verySecretKey1
- LOG_LEVEL=info
depends_on:
mongo-init:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
interval: 5s
timeout: 5s
retries: 12
29 changes: 29 additions & 0 deletions .github/md-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"raftSessions": 1,
"raftMembers": 5,
"bucketdCount": 1,
"bucketdWorkers": 1,
"basePorts": {
"bucketd": 9000,
"repd": 4200,
"repdAdmin": 4250
},
"logLevel": "info",
"env": {
"METADATA_NEW_BUCKETS_VFORMAT": "v0",
"S3_VERSION_ID_ENCODING_TYPE":"hex"
},
"migration": {
"deploy": false,
"raftSessions": 0,
"raftMembers": 5,
"bucketdCount": 1,
"bucketdWorkers": 1,
"basePorts": {
"bucketd": 9001,
"repd": 4700,
"repdAdmin": 4750
},
"logLevel": "info"
}
}
19 changes: 19 additions & 0 deletions .github/scripts/wait_for_local_port.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e

PORT=$1
TIMEOUT=${2:-30}

echo "Waiting for port $PORT to be ready (timeout: ${TIMEOUT}s)..."

for i in $(seq 1 $TIMEOUT); do
if nc -z localhost $PORT 2>/dev/null; then
echo "Port $PORT is ready!"
exit 0
fi
echo "Attempt $i/$TIMEOUT: Port $PORT not ready yet..."
sleep 1
done

echo "ERROR: Port $PORT did not become ready within ${TIMEOUT}s"
exit 1
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: release
run-name: release ${{ inputs.tag }}

on:
push:
branches:
- improvement/CLDSRVCLT-7
workflow_dispatch:
inputs:
tag:
description: 'Tag to be released (e.g., 1.0.0)'
required: true



jobs:
build-and-tag:
name: Build and tag
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Setup Smithy CLI
uses: ./.github/actions/setup-smithy

- name: Build project
run: yarn build

- name: Create Tag with Build Artifacts
run: |
# Configure git user to the GitHub Actions bot
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

# Force add the build folders (even if they are in .gitignore)
git add -f dist build

# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes in build folders or build failed to produce output."
exit 1
fi

# Determine tag name
TAG_NAME="${{ inputs.tag }}"
if [ -z "$TAG_NAME" ]; then
TAG_NAME="test-${{ github.sha }}"
fi

# Commit the build artifacts
git commit -m "Build artifacts for version $TAG_NAME"

# Create the tag
git tag $TAG_NAME

# Push the tag to the repository
git push origin $TAG_NAME

# Export tag name for next step
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
id: create_tag

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.create_tag.outputs.tag_name }}
name: Release ${{ steps.create_tag.outputs.tag_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131 changes: 131 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Test

on:
push:
branches-ignore:
- 'development/**'

permissions:
contents: read
packages: write

jobs:
lint:
name: Lint and typecheck
runs-on: ubuntu-latest
needs: lint

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Setup Smithy CLI
uses: ./.github/actions/setup-smithy

- name: Build
run: yarn build

- name: TypeScript typecheck
run: yarn typecheck

- name: Lint
run: yarn lint

test-mongodb-backend:
name: Test with MongoDB backend
runs-on: ubuntu-latest
needs: lint

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Setup Smithy CLI
uses: ./.github/actions/setup-smithy

- name: Build
run: yarn build

- name: Start Cloudserver with MongoDB backend
run: docker compose -f .github/docker-compose.cloudserver-mongo.yml up -d

- name: Wait for Cloudserver to be ready
run: |
set -o pipefail
bash .github/scripts/wait_for_local_port.bash 8000 40

- name: Run MongoDB backend tests
run: yarn test:mongo-backend

- name: Stop Cloudserver
if: always()
run: docker compose -f .github/docker-compose.cloudserver-mongo.yml down

test-metadata-backend:
name: Test with Scality metadata backend
runs-on: ubuntu-latest
needs: lint

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Setup Smithy CLI
uses: ./.github/actions/setup-smithy

- name: Build
run: yarn build

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Start Cloudserver with Scality metadata backend
run: docker compose -f .github/docker-compose.cloudserver-metadata.yml up -d

- name: Wait for metadata to be ready
run: |
set -o pipefail
bash .github/scripts/wait_for_local_port.bash 9000 40

- name: Wait for Cloudserver to be ready
run: |
set -o pipefail
bash .github/scripts/wait_for_local_port.bash 8000 60

- name: Run metadata backend tests
run: yarn test:metadata-backend

- name: Stop Cloudserver
if: always()
run: docker compose -f .github/docker-compose.cloudserver-metadata.yml down
Loading