Compare commits

...

2 Commits

Author SHA1 Message Date
Thomas Carmet 51dca126a8 ability to overwrite python interpreter 2023-06-07 22:03:38 -07:00
Alexander Chan 343399ca71 UTAPI-93: backport ghaction 2023-06-05 11:46:46 -07:00
4 changed files with 131 additions and 1 deletions

17
.github/scripts/run_ft_tests.bash vendored Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -x
set -eu -o pipefail
# port for utapi server
PORT=8100
trap killandsleep EXIT
killandsleep () {
kill -9 $(lsof -t -i:$PORT) || true
sleep 10
}
UTAPI_INTERVAL_TEST_MODE=$1 npm start & bash tests/utils/wait_for_local_port.bash $PORT 40
UTAPI_INTERVAL_TEST_MODE=$1 npm run $2

46
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,46 @@
name: release
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to be released'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildk
uses: docker/setup-buildx-action@v1
- name: Login to Registry
uses: docker/login-action@v1
with:
registry: registry.scality.com
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push utapi image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: "registry.scality.com/utapi/utapi:${{ github.event.inputs.tag }}"
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ github.event.inputs.tag }}
tag_name: ${{ github.event.inputs.tag }}
generate_release_notes: true
target_commitish: ${{ github.sha }}

64
.github/workflows/tests.yaml vendored Normal file
View File

@ -0,0 +1,64 @@
---
name: tests
on:
workflow_dispatch:
push:
branches-ignore:
- 'development/**'
jobs:
test:
runs-on: ubuntu-latest
env:
REINDEX_PYTHON_INTERPRETER: python3
strategy:
matrix:
command:
- yarn run lint_md
- yarn run lint
- yarn test
- bash ./.github/scripts/run_ft_tests.bash false ft_test:client
- bash ./.github/scripts/run_ft_tests.bash false ft_test:server
- bash ./.github/scripts/run_ft_tests.bash false ft_test:cron
- bash ./.github/scripts/run_ft_tests.bash true ft_test:interval
services:
redis:
image: bitnami/redis:6.2
env:
ALLOW_EMPTY_PASSWORD: 'yes'
ports:
- 6379:6379
redis-sentinel:
image: bitnami/redis-sentinel:6.2
env:
REDIS_MASTER_SET: scality-s3
REDIS_SENTINEL_PORT_NUMBER: '16379'
REDIS_SENTINEL_QUORUM: '1'
ports:
- 16379:16379
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '10'
cache: 'yarn'
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
- name: Install python deps
run: |
pip install requests
pip install redis
- name: install dependencies
run: yarn install --frozen-lockfile
- run: ${{ matrix.command }}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

View File

@ -12,6 +12,9 @@ const redisClient = require('../utils/redisClient');
const REINDEX_SCHEDULE = '0 0 * * Sun';
const REINDEX_LOCK_KEY = 's3:utapireindex:lock';
const REINDEX_LOCK_TTL = (60 * 60) * 24;
const REINDEX_PYTHON_INTERPRETER = process.env.REINDEX_PYTHON_INTERPRETER !== undefined
? process.env.REINDEX_PYTHON_INTERPRETER
: 'python3.4';
class UtapiReindex {
@ -106,7 +109,7 @@ class UtapiReindex {
_runScript(path, done) {
const flags = this._buildFlags();
this._requestLogger.debug(`launching subprocess ${path} with flags: ${flags}`);
const process = childProcess.spawn('python3.4', [
const process = childProcess.spawn(REINDEX_PYTHON_INTERPRETER, [
path,
...flags,
]);