Deploy Operator Perf Env Weekly CI #183
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
# Nightly CI https://github.com/marketplace/actions/deploy-nightly | |
# https://crontab.guru/ | |
# This is a nightly CI Pipeline against Performance environment using IPI installer - run on Monday | |
# GitHub Actions is limited 6 hours for each job | |
name: Deploy Operator Perf Env Weekly CI | |
# Only trigger, when the build workflow succeeded | |
on: | |
workflow_run: | |
workflows: ["Deploy Assisted installer Perf Env Weekly CI"] | |
types: | |
- completed | |
workflow_dispatch: | |
#on: | |
# push: | |
# branches: [ main ] | |
# Ensures that only one deploy task per branch/environment will run at a time. | |
concurrency: | |
group: performance-environment | |
cancel-in-progress: false | |
jobs: | |
ocp_operator_installation: | |
name: Operator | |
runs-on: ubuntu-latest | |
strategy: | |
# run one job every time | |
max-parallel: 1 | |
# continue to next job if failed | |
fail-fast: false | |
matrix: | |
resource: ['kata', 'lso', 'odf', 'cnv', 'infra', 'custom'] | |
outputs: | |
install_resource_time_output: ${{ steps.ocp_install_resource_step.outputs.install_resource_time }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- 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: ⚙️ Set Kubeconfig and hosts | |
env: | |
KUBECONFIG_CONTENTS: ${{ secrets.PERF_KUBECONFIG }} | |
RUNNER_PATH: ${{ secrets.RUNNER_PATH }} | |
OCP_HOSTS: ${{ secrets.PERF_OCP_HOSTS }} | |
run: | | |
mkdir -p "$RUNNER_PATH/.kube/" | |
echo "$KUBECONFIG_CONTENTS" > "$RUNNER_PATH/.kube/config" | |
echo "KUBECONFIG_PATH=$RUNNER_PATH/.kube/config" >> "$GITHUB_ENV" | |
sudo tee -a /etc/hosts <<< "$OCP_HOSTS" > /dev/null | |
- name: ☉ install ${{ matrix.resource }} Operator | |
env: | |
CNV_VERSION: "4.14" | |
ODF_VERSION: "4.13" | |
NUM_ODF_DISK: "4" | |
KATA_CSV: "" | |
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | |
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | |
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_OC_USER: ${{ secrets.PERF_PROVISION_OC_USER }} | |
PROVISION_PORT: ${{ secrets.PERF_PROVISION_PORT }} | |
GITHUB_REPOSITORY_SHORT: ${{ secrets.GIT_REPOSITORY_SHORT }} | |
CONTAINER_KUBECONFIG_PATH: ${{ secrets.CONTAINER_KUBECONFIG_PATH }} | |
CONTAINER_PRIVATE_KEY_PATH: ${{ secrets.CONTAINER_PRIVATE_KEY_PATH }} | |
KUBEADMIN_PASSWORD: ${{ secrets.PERF_KUBEADMIN_PASSWORD }} | |
RUNNER_PATH: ${{ secrets.RUNNER_PATH }} | |
CNV_NIGHTLY_REGISTERED: ${{ secrets.CNV_NIGHTLY_REGISTERED }} | |
CNV_NIGHTLY_CATALOG_SOURCE: ${{ secrets.CNV_NIGHTLY_CATALOG_SOURCE }} | |
WORKER_DISK_IDS: ${{ secrets.PERF_WORKER_DISK_IDS }} | |
run: | | |
build=$(pip freeze | grep benchmark-runner | sed 's/==/=/g') | |
build_version="$(cut -d'=' -f2 <<<"$build")" | |
start=$(printf '%(%s)T' -1) | |
echo '>>>>>>>>>>>>>>>>>>>>>>>>>>> Start ${{ matrix.resource }} installation >>>>>>>>>>>>>>>>>>>>>>>>>>>>' | |
# cnv-nightly | |
if [[ "${{ matrix.resource }}" == "cnv" ]] | |
then | |
scp -r "$RUNNER_PATH/.kube/config" provision:"$CONTAINER_KUBECONFIG_PATH" | |
echo -e "QUAY_USERNAME=$QUAY_USERNAME\nQUAY_PASSWORD=$QUAY_PASSWORD\n$CNV_NIGHTLY_REGISTERED" > "$RUNNER_PATH/nightly_cnv_registered.sh" | |
echo -e "$CNV_NIGHTLY_CATALOG_SOURCE" > "$RUNNER_PATH/cnv_nightly_catlog_source.yaml" | |
sed -i "s/{{ cnv_version }}/$CNV_VERSION/g" $RUNNER_PATH/cnv_nightly_catlog_source.yaml | |
scp -r "$RUNNER_PATH/cnv_nightly_catlog_source.yaml" provision:"/tmp/cnv_nightly_catlog_source.yaml" | |
scp -r "$RUNNER_PATH/nightly_cnv_registered.sh" provision:"/tmp/nightly_cnv_registered.sh" | |
ssh -t provision "chmod +x /tmp/nightly_cnv_registered.sh;/tmp/./nightly_cnv_registered.sh;oc create -f /tmp/cnv_nightly_catlog_source.yaml;rm -f /tmp/nightly_cnv_registered.sh;rm -f /tmp/cnv_nightly_catlog_source.yaml" | |
fi | |
podman run --rm -e IBM_API_KEY="$IBM_API_KEY" -e GITHUB_TOKEN="$GITHUB_TOKEN" -e KUBEADMIN_PASSWORD="$KUBEADMIN_PASSWORD" -e INSTALL_OCP_RESOURCES="True" -e CNV_VERSION="$CNV_VERSION" -e QUAY_USERNAME="$QUAY_USERNAME" -e QUAY_PASSWORD="$QUAY_PASSWORD" -e ODF_VERSION="$ODF_VERSION" -e KATA_CSV="$KATA_CSV" -e NUM_ODF_DISK="$NUM_ODF_DISK" -e INSTALL_RESOURCES_LIST="[ '${{ matrix.resource }}' ]" -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_OC_USER="$PROVISION_OC_USER" -e PROVISION_PORT="$PROVISION_PORT" -e GITHUB_REPOSITORY_SHORT="$GITHUB_REPOSITORY_SHORT" -e WORKER_DISK_IDS="$WORKER_DISK_IDS" -e PROVISION_TIMEOUT="3600" -e log_level="INFO" -v "$PROVISION_PRIVATE_KEY_PATH":"$CONTAINER_PRIVATE_KEY_PATH" -v "$KUBECONFIG_PATH":"$CONTAINER_KUBECONFIG_PATH" --privileged "quay.io/ebattat/benchmark-runner:latest" | |
echo '>>>>>>>>>>>>>>>>>>>>>>>>>> End ${{ matrix.resource }} installation >>>>>>>>>>>>>>>>>>>>>>>>>>>>' | |
end=$(printf '%(%s)T' -1) | |
echo "INSTALL_OCP_RESOURCE_MINUTES_TIME=$(( (( end - start )) / 60))" >> "$GITHUB_ENV" | |
- id: ocp_install_resource_step | |
run: echo "install_resource_time=$INSTALL_OCP_RESOURCE_MINUTES_TIME" >> $GITHUB_OUTPUT | |
- name: ☉ Rerun OCP Operator Resources install after failure | |
env: | |
CNV_VERSION: "4.14" | |
ODF_VERSION: "4.13" | |
NUM_ODF_DISK: "4" | |
KATA_CSV: "" | |
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | |
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | |
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_OC_USER: ${{ secrets.PERF_PROVISION_OC_USER }} | |
PROVISION_PORT: ${{ secrets.PERF_PROVISION_PORT }} | |
GITHUB_REPOSITORY_SHORT: ${{ secrets.GIT_REPOSITORY_SHORT }} | |
CONTAINER_KUBECONFIG_PATH: ${{ secrets.CONTAINER_KUBECONFIG_PATH }} | |
CONTAINER_PRIVATE_KEY_PATH: ${{ secrets.CONTAINER_PRIVATE_KEY_PATH }} | |
KUBEADMIN_PASSWORD: ${{ secrets.PERF_KUBEADMIN_PASSWORD }} | |
RUNNER_PATH: ${{ secrets.RUNNER_PATH }} | |
CNV_NIGHTLY_REGISTERED: ${{ secrets.CNV_NIGHTLY_REGISTERED }} | |
CNV_NIGHTLY_CATALOG_SOURCE: ${{ secrets.CNV_NIGHTLY_CATALOG_SOURCE }} | |
WORKER_DISK_IDS: ${{ secrets.PERF_WORKER_DISK_IDS }} | |
if: ${{ failure() }} | |
run: | | |
build=$(pip freeze | grep benchmark-runner | sed 's/==/=/g') | |
build_version="$(cut -d'=' -f2 <<<"$build")" | |
start=$(printf '%(%s)T' -1) | |
echo '>>>>>>>>>>>>>>>>>>>>>>>>>> Start OCP Resource Install >>>>>>>>>>>>>>>>>>>>>>>>>>>>' | |
# cnv-nightly | |
scp -r "$RUNNER_PATH/.kube/config" provision:"$CONTAINER_KUBECONFIG_PATH" | |
echo -e "QUAY_USERNAME=$QUAY_USERNAME\nQUAY_PASSWORD=$QUAY_PASSWORD\n$CNV_NIGHTLY_REGISTERED" > "$RUNNER_PATH/nightly_cnv_registered.sh" | |
echo -e "$CNV_NIGHTLY_CATALOG_SOURCE" > "$RUNNER_PATH/cnv_nightly_catlog_source.yaml" | |
sed -i "s/{{ cnv_version }}/$CNV_VERSION/g" $RUNNER_PATH/cnv_nightly_catlog_source.yaml | |
scp -r "$RUNNER_PATH/cnv_nightly_catlog_source.yaml" provision:"/tmp/cnv_nightly_catlog_source.yaml" | |
scp -r "$RUNNER_PATH/nightly_cnv_registered.sh" provision:"/tmp/nightly_cnv_registered.sh" | |
ssh -t provision "chmod +x /tmp/nightly_cnv_registered.sh;/tmp/./nightly_cnv_registered.sh;oc create -f /tmp/cnv_nightly_catlog_source.yaml;rm -f /tmp/nightly_cnv_registered.sh;rm -f /tmp/cnv_nightly_catlog_source.yaml" | |
podman run --rm -e IBM_API_KEY="$IBM_API_KEY" -e GITHUB_TOKEN="$GITHUB_TOKEN" -e KUBEADMIN_PASSWORD="$KUBEADMIN_PASSWORD" -e INSTALL_OCP_RESOURCES="True" -e CNV_VERSION="$CNV_VERSION" -e QUAY_USERNAME="$QUAY_USERNAME" -e QUAY_PASSWORD="$QUAY_PASSWORD" -e ODF_VERSION="$ODF_VERSION" -e KATA_CSV="$KATA_CSV" -e NUM_ODF_DISK="$NUM_ODF_DISK" -e INSTALL_RESOURCES_LIST="['kata', 'lso', 'odf', 'cnv', 'infra', 'custom']" -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_OC_USER="$PROVISION_OC_USER" -e PROVISION_PORT="$PROVISION_PORT" -e GITHUB_REPOSITORY_SHORT="$GITHUB_REPOSITORY_SHORT" -e WORKER_DISK_IDS="$WORKER_DISK_IDS" -e PROVISION_TIMEOUT="3600" -e log_level="INFO" -v "$PROVISION_PRIVATE_KEY_PATH":"$CONTAINER_PRIVATE_KEY_PATH" -v "$KUBECONFIG_PATH":"$CONTAINER_KUBECONFIG_PATH" --privileged "quay.io/ebattat/benchmark-runner:latest" | |
echo '>>>>>>>>>>>>>>>>>>>>>>>>>> End OCP Resource Install >>>>>>>>>>>>>>>>>>>>>>>>>>>>' | |
end=$(printf '%(%s)T' -1) | |
echo "INSTALL_OCP_RESOURCE_MINUTES_TIME=$(( (( end - start )) / 60))" >> "$GITHUB_ENV" |