Skip to content

Commit

Permalink
install operator on bastion (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebattat authored Nov 10, 2023
1 parent b318fc4 commit 899c15d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 85 deletions.
43 changes: 1 addition & 42 deletions .github/workflows/Weekly_Func_Env_Operator_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,50 +114,9 @@ jobs:
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"
ssh -t provision "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"
43 changes: 1 addition & 42 deletions .github/workflows/Weekly_Perf_Env_Operator_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,50 +114,9 @@ jobs:
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"
ssh -t provision "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"
6 changes: 5 additions & 1 deletion benchmark_runner/main/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def install_resources():
ibm_operations = IBMOperations(user=provision_user)
ibm_operations.ibm_connect()
install_resources_list = environment_variables_dict.get('install_resources_list', '')
resources = ast.literal_eval(install_resources_list)
# convert str to list
try:
resources = ast.literal_eval(install_resources_list) if isinstance(install_resources_list, str) else install_resources_list
except (ValueError, SyntaxError):
resources = [install_resources_list]
logger.info(f'Start IBM OCP resources installation')
oc = ibm_operations.oc_login()
ibm_operations.verify_cluster_is_up(oc)
Expand Down

0 comments on commit 899c15d

Please sign in to comment.