Deploy Assisted installer Perf Env Weekly CI #212
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://crontab.guru/ | |
# Deploy OCP SNO Performance environment using Assisted Installer - run on Thursday | |
name: Deploy Assisted installer Perf Env Weekly CI | |
on: | |
schedule: | |
- cron: '0 4 * * 4' # run on Thursday at 4 AM UTC/ 0 AM EDT | |
workflow_dispatch: | |
# Ensures that only one deploy task per branch/environment will run at a time. | |
concurrency: | |
group: performance-environment | |
cancel-in-progress: false | |
jobs: | |
ocp_installer: | |
name: OCP | |
runs-on: ubuntu-latest | |
strategy: | |
# run one job every time | |
max-parallel: 1 | |
# continue to next job if failed | |
fail-fast: false | |
matrix: | |
step: [ 'run_ibm_ocp_installer', 'verify_ibm_install_complete' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install latest benchmark-runner | |
run: | | |
python -m pip install --upgrade pip | |
pip install benchmark-runner | |
- name: ⚙️ SET SSH key | |
env: | |
PROVISION_PRIVATE_KEY: ${{ secrets.PERF_PROVISION_PRIVATE_KEY }} | |
RUNNER_PATH: ${{ secrets.RUNNER_PATH }} | |
PROVISION_IP: ${{ secrets.PERF_PROVISION_IP }} | |
PROVISION_USER: ${{ secrets.PERF_PROVISION_USER }} | |
run: | | |
mkdir -p "$RUNNER_PATH/.ssh/" | |
echo "$PROVISION_PRIVATE_KEY" > $RUNNER_PATH/private_key.txt | |
sudo chmod 600 $RUNNER_PATH/private_key.txt | |
echo "PROVISION_PRIVATE_KEY_PATH=$RUNNER_PATH/private_key.txt" >> "$GITHUB_ENV" | |
cat >> "$RUNNER_PATH/.ssh/config" <<END | |
Host provision | |
HostName $PROVISION_IP | |
User $PROVISION_USER | |
IdentityFile $RUNNER_PATH/private_key.txt | |
StrictHostKeyChecking no | |
ServerAliveInterval 30 | |
ServerAliveCountMax 5 | |
END | |
- name: ▶ OCP assisted installer | |
env: | |
INSTALL_OCP_VERSION: "latest-4.16" | |
OCP_CLIENT_VERSION: "4.16.0" | |
IBM_API_KEY: ${{ secrets.IBM_API_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
WORKER_IDS: ${{ secrets.PERF_WORKER_IDS }} | |
PROVISION_IP: ${{ secrets.PERF_PROVISION_IP }} | |
PROVISION_USER: ${{ secrets.PERF_PROVISION_USER }} | |
PROVISION_PORT: ${{ secrets.PERF_PROVISION_PORT }} | |
PROVISION_KUBEADMIN_PASSWORD_PATH: ${{ secrets.PERF_PROVISION_KUBEADMIN_PASSWORD_PATH }} | |
PROVISION_KUBECONFIG_PATH: ${{ secrets.PERF_PROVISION_KUBECONFIG_PATH }} | |
PROVISION_INSTALLER_PATH: ${{ secrets.PERF_PROVISION_INSTALLER_PATH }} | |
PROVISION_INSTALLER_CMD: ${{ secrets.PERF_PROVISION_INSTALLER_CMD }} | |
PROVISION_INSTALLER_LOG: ${{ secrets.PERF_PROVISION_INSTALLER_LOG }} | |
GITHUB_REPOSITORY_SHORT: ${{ secrets.GIT_REPOSITORY_SHORT }} | |
CONTAINER_PRIVATE_KEY_PATH: ${{ secrets.CONTAINER_PRIVATE_KEY_PATH }} | |
RUNNER_PATH: ${{ secrets.RUNNER_PATH }} | |
run: | | |
# Retry function | |
retry() { | |
local max_attempts=3 | |
local count=0 | |
until [ $count -ge $max_attempts ] | |
do | |
podman run --rm \ | |
-e OCP_ENV_FLAVOR="PERF" \ | |
-e IBM_API_KEY="$IBM_API_KEY" \ | |
-e GITHUB_TOKEN="$GITHUB_TOKEN" \ | |
-e INSTALL_OCP_VERSION="$INSTALL_OCP_VERSION" \ | |
-e INSTALL_STEP="${{ matrix.step }}" \ | |
-e WORKER_IDS="$WORKER_IDS" \ | |
-e PROVISION_IP="$PROVISION_IP" \ | |
-e CONTAINER_PRIVATE_KEY_PATH="$CONTAINER_PRIVATE_KEY_PATH" \ | |
-e PROVISION_USER="$PROVISION_USER" \ | |
-e PROVISION_PORT="$PROVISION_PORT" \ | |
-e PROVISION_KUBEADMIN_PASSWORD_PATH="$PROVISION_KUBEADMIN_PASSWORD_PATH" \ | |
-e PROVISION_KUBECONFIG_PATH="$PROVISION_KUBECONFIG_PATH" \ | |
-e PROVISION_INSTALLER_PATH="$PROVISION_INSTALLER_PATH" \ | |
-e PROVISION_INSTALLER_CMD="$PROVISION_INSTALLER_CMD" \ | |
-e PROVISION_INSTALLER_LOG="$PROVISION_INSTALLER_LOG" \ | |
-e GITHUB_REPOSITORY_SHORT="$GITHUB_REPOSITORY_SHORT" \ | |
-e PROVISION_TIMEOUT="3600" \ | |
-e log_level="INFO" \ | |
-v "$PROVISION_PRIVATE_KEY_PATH":"$CONTAINER_PRIVATE_KEY_PATH" \ | |
-v "/$RUNNER_PATH/.ssh/config":"/$PROVISION_USER/.ssh/config" \ | |
--privileged "${{ secrets.QUAY_BENCHMARK_RUNNER_REPOSITORY }}" | |
if [ $? -eq 0 ]; then | |
return 0 | |
fi | |
count=$((count + 1)) | |
echo "Retrying ($count/$max_attempts)..." | |
sleep 10 | |
done | |
return 1 | |
} | |
build=$(pip freeze | grep benchmark-runner | sed 's/==/=/g') | |
build_version="$(cut -d'=' -f2 <<<"$build")" | |
echo '>>>>>>>>>>>>>>>>>>>>>>>>>> OCP start step: ${{ matrix.step }} >>>>>>>>>>>>>>>>>>>>>>>>>>>>' | |
retry | |
echo '>>>>>>>>>>>>>>>>>>>>>>>>>> OCP end step: ${{ matrix.step }} >>>>>>>>>>>>>>>>>>>>>>>>>>>>' |