mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #43579 from ClickHouse/universal-runners
Prepare CI for universal runners preallocated pool
This commit is contained in:
commit
88c338c090
@ -11,6 +11,17 @@ import requests
|
|||||||
import boto3
|
import boto3
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
|
||||||
|
UNIVERSAL_LABEL = "universal"
|
||||||
|
RUNNER_TYPE_LABELS = [
|
||||||
|
"builder",
|
||||||
|
"func-tester",
|
||||||
|
"func-tester-aarch64",
|
||||||
|
"fuzzer-unit-tester",
|
||||||
|
"stress-tester",
|
||||||
|
"style-checker",
|
||||||
|
"style-checker-aarch64",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def get_dead_runners_in_ec2(runners):
|
def get_dead_runners_in_ec2(runners):
|
||||||
ids = {
|
ids = {
|
||||||
@ -170,26 +181,23 @@ def list_runners(access_token):
|
|||||||
def group_runners_by_tag(listed_runners):
|
def group_runners_by_tag(listed_runners):
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
RUNNER_TYPE_LABELS = [
|
def add_to_result(tag, runner):
|
||||||
"builder",
|
if tag not in result:
|
||||||
"func-tester",
|
result[tag] = []
|
||||||
"func-tester-aarch64",
|
result[tag].append(runner)
|
||||||
"fuzzer-unit-tester",
|
|
||||||
"stress-tester",
|
|
||||||
"style-checker",
|
|
||||||
"style-checker-aarch64",
|
|
||||||
]
|
|
||||||
for runner in listed_runners:
|
for runner in listed_runners:
|
||||||
|
if UNIVERSAL_LABEL in runner.tags:
|
||||||
|
# Do not proceed other labels if UNIVERSAL_LABEL is included
|
||||||
|
add_to_result(UNIVERSAL_LABEL, runner)
|
||||||
|
continue
|
||||||
|
|
||||||
for tag in runner.tags:
|
for tag in runner.tags:
|
||||||
if tag in RUNNER_TYPE_LABELS:
|
if tag in RUNNER_TYPE_LABELS:
|
||||||
if tag not in result:
|
add_to_result(tag, runner)
|
||||||
result[tag] = []
|
|
||||||
result[tag].append(runner)
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if "unlabeled" not in result:
|
add_to_result("unlabeled", runner)
|
||||||
result["unlabeled"] = []
|
|
||||||
result["unlabeled"].append(runner)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
1
tests/ci/ci_runners_metrics_lambda/build_and_deploy_archive.sh
Symbolic link
1
tests/ci/ci_runners_metrics_lambda/build_and_deploy_archive.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../team_keys_lambda/build_and_deploy_archive.sh
|
@ -1,13 +0,0 @@
|
|||||||
FROM public.ecr.aws/lambda/python:3.9
|
|
||||||
|
|
||||||
# Install the function's dependencies using file requirements.txt
|
|
||||||
# from your project folder.
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
|
||||||
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
|
|
||||||
|
|
||||||
# Copy function code
|
|
||||||
COPY app.py ${LAMBDA_TASK_ROOT}
|
|
||||||
|
|
||||||
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
|
|
||||||
CMD [ "app.handler" ]
|
|
@ -2,10 +2,13 @@
|
|||||||
set -xeo pipefail
|
set -xeo pipefail
|
||||||
|
|
||||||
WORKDIR=$(dirname "$0")
|
WORKDIR=$(dirname "$0")
|
||||||
|
WORKDIR=$(readlink -f "${WORKDIR}")
|
||||||
cd "$WORKDIR"
|
cd "$WORKDIR"
|
||||||
|
|
||||||
PY_EXEC=python3.9
|
PY_VERSION=3.9
|
||||||
LAMBDA_NAME=$(basename "$PWD")
|
PY_EXEC="python${PY_VERSION}"
|
||||||
|
DOCKER_IMAGE="python:${PY_VERSION}-slim"
|
||||||
|
LAMBDA_NAME=$(basename "$WORKDIR")
|
||||||
LAMBDA_NAME=${LAMBDA_NAME//_/-}
|
LAMBDA_NAME=${LAMBDA_NAME//_/-}
|
||||||
PACKAGE=lambda-package
|
PACKAGE=lambda-package
|
||||||
rm -rf "$PACKAGE" "$PACKAGE".zip
|
rm -rf "$PACKAGE" "$PACKAGE".zip
|
||||||
@ -14,10 +17,12 @@ cp app.py "$PACKAGE"
|
|||||||
if [ -f requirements.txt ]; then
|
if [ -f requirements.txt ]; then
|
||||||
VENV=lambda-venv
|
VENV=lambda-venv
|
||||||
rm -rf "$VENV" lambda-package.zip
|
rm -rf "$VENV" lambda-package.zip
|
||||||
"$PY_EXEC" -m venv "$VENV"
|
docker run --rm --user="${UID}" --volume="${WORKDIR}:/lambda" --workdir="/lambda" "${DOCKER_IMAGE}" \
|
||||||
# shellcheck disable=SC1091
|
/bin/bash -c "
|
||||||
source "$VENV/bin/activate"
|
'$PY_EXEC' -m venv '$VENV' &&
|
||||||
pip install -r requirements.txt
|
source '$VENV/bin/activate' &&
|
||||||
|
pip install -r requirements.txt
|
||||||
|
"
|
||||||
cp -rT "$VENV/lib/$PY_EXEC/site-packages/" "$PACKAGE"
|
cp -rT "$VENV/lib/$PY_EXEC/site-packages/" "$PACKAGE"
|
||||||
rm -r "$PACKAGE"/{pip,pip-*,setuptools,setuptools-*}
|
rm -r "$PACKAGE"/{pip,pip-*,setuptools,setuptools-*}
|
||||||
fi
|
fi
|
||||||
|
@ -46,15 +46,17 @@ curl "${TEAM_KEYS_URL}" > /home/ubuntu/.ssh/authorized_keys2
|
|||||||
chown ubuntu: /home/ubuntu/.ssh -R
|
chown ubuntu: /home/ubuntu/.ssh -R
|
||||||
|
|
||||||
|
|
||||||
# Create a pre-run script that will restart docker daemon before the job started
|
# Create a pre-run script that will provide diagnostics info
|
||||||
mkdir -p /tmp/actions-hooks
|
mkdir -p /tmp/actions-hooks
|
||||||
cat > /tmp/actions-hooks/pre-run.sh << 'EOF'
|
cat > /tmp/actions-hooks/pre-run.sh << EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -xuo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
echo "Runner's public DNS: $(ec2metadata --public-hostname)"
|
echo "Runner's public DNS: $(ec2metadata --public-hostname)"
|
||||||
|
echo "Runner's labels: ${LABELS}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Create a post-run script that will restart docker daemon before the job started
|
||||||
cat > /tmp/actions-hooks/post-run.sh << 'EOF'
|
cat > /tmp/actions-hooks/post-run.sh << 'EOF'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -xuo pipefail
|
set -xuo pipefail
|
||||||
|
Loading…
Reference in New Issue
Block a user