Skip to content

Commit

Permalink
OPCT-257: clean up plugin scripts for v0.5 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mtulio committed Aug 13, 2024
1 parent ab7f0f8 commit 59997f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 459 deletions.
47 changes: 0 additions & 47 deletions artifacts-collector/collector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,9 @@ collect_must_gather() {
os_log_info "[executor][PluginID#${PLUGIN_ID}] must-gather collector done."
}

# Collect e2e Conformance tests from a given suite, it will save the list into a file.
collect_tests_conformance() {
local suite
local ofile
suite=$1; shift
ofile=$1; shift
os_log_info "[executor][PluginID#${PLUGIN_ID}] Collecting e2e list> ${suite}"

# TODO: receive the test list from step, instead of requiring the openshift-tests dependency in collector.
# TODO: it's desired to collect all openshift-tests metadata.
truncate -s 0 "${ofile}"
CNT_T=$(${UTIL_OTESTS_BIN} run "${suite}" --dry-run -o "${ofile}" | wc -l)
CNT_C=$(wc -l "${ofile}" | awk '{print$1}')

os_log_info "[executor][PluginID#${PLUGIN_ID}] e2e count ${suite} openshift-tests> ${CNT_T}"
os_log_info "[executor][PluginID#${PLUGIN_ID}] e2e count ${suite} collected> ${CNT_C}"
}

collect_tests_upgrade() {
suite="${OPENSHIFT_TESTS_SUITE_UPGRADE}"
ofile="./artifacts_e2e-tests_openshift-upgrade.txt"
truncate -s 0 ${ofile}
if [[ "${RUN_MODE:-''}" == "${PLUGIN_RUN_MODE_UPGRADE}" ]]; then
# TODO: receive the test list from step, instead of requiring the openshift-tests dependency in collector.
# TODO: it's desired to collect all openshift-tests metadata.
${UTIL_OTESTS_BIN} run-upgrade "${suite}" --to-image "${UPGRADE_RELEASES:-}" --dry-run || true > ${ofile}
CNT_T=$(${UTIL_OTESTS_BIN} run-upgrade "${suite}" --to-image "${UPGRADE_RELEASES:-}" --dry-run || true | wc -l)
os_log_info "[executor][PluginID#${PLUGIN_ID}] e2e count ${suite} openshift-tests> ${CNT_T}"
fi
CNT_C=$(wc -l ${ofile} | awk '{print$1}')
os_log_info "[executor][PluginID#${PLUGIN_ID}] e2e count ${suite} collected> ${CNT_C}"
}

# collect_performance_etcdfio run the recommended method to measure the disk information
# for etcd deployments. It will run into two nodes for each role (master and worker).
collect_performance_etcdfio() {

os_log_info "[executor][PluginID#${PLUGIN_ID}] Starting Artifacts Collector - Performance - etcdfio"
local image
local msg_prefix
Expand Down Expand Up @@ -201,19 +167,6 @@ run_plugin_collector() {
send_test_progress "status=running=collecting metrics";
collect_metrics || true

# DEPRECATING: as it is streamed by the openshift-tests-plugin, tests container.
# Collecting e2e list for Kubernetes Conformance
#send_test_progress "status=running=collecting e2e=${OPENSHIFT_TESTS_SUITE_KUBE_CONFORMANCE}";
#collect_tests_conformance "${OPENSHIFT_TESTS_SUITE_KUBE_CONFORMANCE}" "./artifacts_e2e-tests_kubernetes-conformance.txt" || true

# Collecting e2e list for OpenShift Conformance
#send_test_progress "status=running=collecting e2e=${OPENSHIFT_TESTS_SUITE_OPENSHIFT_CONFORMANCE}";
#collect_tests_conformance "${OPENSHIFT_TESTS_SUITE_OPENSHIFT_CONFORMANCE}" "./artifacts_e2e-tests_openshift-conformance.txt" || true

# Collecting e2e list for OpenShift Upgrade (when mode=upgrade)
#send_test_progress "status=running=collecting e2e=upgrade";
#collect_tests_upgrade || true

# Creating Result file used to publish to sonobuoy. (last step)
send_test_progress "status=running=saving artifacts";

Expand Down
5 changes: 1 addition & 4 deletions artifacts-collector/entrypoint-collector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
set -o pipefail
set -o nounset

declare -gxr SERVICE_NAME="plugin"
declare -gxr SERVICE_NAME="collector"

# shellcheck disable=SC1091
source "$(dirname "$0")"/global_env.sh
Expand Down Expand Up @@ -45,9 +45,6 @@ ${UTIL_OC_BIN} login "${KUBE_API_INT}" \
--token="$(cat "${SA_TOKEN_PATH}")" \
--certificate-authority="${SA_CA_PATH}" || true;

os_log_info "starting utilities extractor..."
#start_utils_extractor

#
# Replace wait-plugin for progress reporter
#
Expand Down
65 changes: 2 additions & 63 deletions artifacts-collector/global_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,26 @@ declare -gx PLUGIN_NAME
declare -gx PLUGIN_BLOCKED_BY
declare -gx DEV_TESTS_COUNT

declare -grx CERT_TESTS_DIR="./tests/${OPENSHIFT_VERSION:-"v4.10"}"

declare -grx IMAGE_OVERRIDE_MUST_GATHER="${IMAGE_OVERRIDE_MUST_GATHER:-"quay.io/opct/must-gather-monitoring:v0.5.0"}"
declare -grx VERSION_IMAGE_MUST_GATHER="${VERSION_IMAGE_MUST_GATHER:-"v0.5.0"}"

declare -gx PLUGIN_ID
declare -gx CERT_TEST_FILE
declare -gx CERT_TEST_COUNT
declare -gx CERT_TEST_SUITE
declare -gx CERT_TEST_PARALLEL
declare -gx OPENSHIFT_TESTS_EXTRA_ARGS
CERT_TEST_COUNT=0

declare -gAx PROGRESS
declare -grx PROGRESS_URL="http://127.0.0.1:8099/progress"
declare -grx SHARED_DIR="/tmp/shared"
declare -grx SONOBUOY_BIN="/usr/bin/sonobuoy"
declare -grx STATUS_FILE="${SHARED_DIR}/sonobuoy-status.json"
declare -grx STATUS_UPDATE_INTERVAL_SEC="5"
declare -grx E2E_PARALLEL_DEFAULT=0

declare -grx RESULTS_DIR="${RESULTS_DIR:-/tmp/sonobuoy/results}"
declare -grx RESULTS_DONE_NOTIFY="${RESULTS_DIR}/done"
declare -grx PLUGIN_DONE_NOTIFY="${SHARED_DIR}/plugin.done"
#declare -grx RESULTS_PIPE="${SHARED_DIR}/status_pipe"
declare -grx RESULTS_PIPE="/tmp/shared/fifo"
declare -grx RESULTS_SCRIPTS="${SHARED_DIR}/plugin-scripts"

declare -grx KUBECONFIG="${SHARED_DIR}/kubeconfig"
declare -grx KUBE_API_INT="https://172.30.0.1:443"
declare -grx KUBE_API_INT="https://kubernetes.default.svc:443"
declare -grx SA_CA_PATH="/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
declare -grx SA_TOKEN_PATH="/var/run/secrets/kubernetes.io/serviceaccount/token"

declare -gx MIRROR_IMAGE_REPOSITORY

# Utilities
declare -grx UTIL_OTESTS_BIN="${SHARED_DIR}/openshift-tests"
declare -grx UTIL_OTESTS_READY="${UTIL_OTESTS_BIN}.ready"
declare -grx UTIL_OTESTS_FAILED="${UTIL_OTESTS_BIN}.failed"

declare -grx UTIL_OC_BIN="/usr/bin/oc"
declare -grx UTIL_OC_READY="${SHARED_DIR}/oc.ready"
declare -grx UTIL_OC_FAILED="${SHARED_DIR}/oc.failed"

declare -grx CHECK_MCP_READY="${SHARED_DIR}/upgrade-mcp.ready"
declare -grx CHECK_MCP_FAILED="${SHARED_DIR}/upgrade-mcp.failed"

# PLUGIN Instances vars
## openshift-cluster-upgrade
declare -grx PLUGIN_ID_OPENSHIFT_UPGRADE="05"
declare -grx PLUGIN_NAME_OPENSHIFT_UPGRADE="${PLUGIN_ID_OPENSHIFT_UPGRADE}-openshift-cluster-upgrade"
declare -grx OPENSHIFT_TESTS_SUITE_UPGRADE="none"

## openshift-kube-conformance
declare -grx PLUGIN_ID_KUBE_CONFORMANCE="10"
declare -grx PLUGIN_NAME_KUBE_CONFORMANCE="${PLUGIN_ID_KUBE_CONFORMANCE}-openshift-kube-conformance"
declare -grx OPENSHIFT_TESTS_SUITE_KUBE_CONFORMANCE="${PLUGIN_SUITE_KUBE_CONFORMANCE:-kubernetes/conformance}"

## openshift-conformance-validated
declare -grx PLUGIN_ID_OPENSHIFT_CONFORMANCE="20"
declare -grx PLUGIN_NAME_OPENSHIFT_CONFORMANCE="${PLUGIN_ID_OPENSHIFT_CONFORMANCE}-openshift-conformance-validated"
declare -grx OPENSHIFT_TESTS_SUITE_OPENSHIFT_CONFORMANCE="${PLUGIN_SUITE_OPENSHIFT_CONFORMANCE:-openshift/conformance}"

## openshift-artifacts-collector
declare -grx PLUGIN_ID_OPENSHIFT_ARTIFACTS_COLLECTOR="99"
declare -grx PLUGIN_NAME_OPENSHIFT_ARTIFACTS_COLLECTOR="${PLUGIN_ID_OPENSHIFT_ARTIFACTS_COLLECTOR}-openshift-artifacts-collector"

# Plugin Execution modes (| regular | upgrade). Default: regular|''
declare -grx PLUGIN_RUN_MODE_UPGRADE="upgrade"

# Sonobuot Plugin Statuses
declare -grx SONOBUOY_PLUGIN_STATUS_COMPLETE="complete"
declare -grx SONOBUOY_PLUGIN_STATUS_FAILED="failed"

## Setting 3h for the plugin blocker feature (wait-plugin).
## We don't want to run forever, however starting prematurely is not acceptable.
declare -grx PLUGIN_WAIT_TIMEOUT_COUNT=1080
declare -grx PLUGIN_WAIT_TIMEOUT_INTERVAL=10

# Defaults
CERT_TEST_FILE=""
CERT_TEST_SUITE=""
CERT_TEST_COUNT=0
CERT_TEST_PARALLEL=${E2E_PARALLEL:-${E2E_PARALLEL_DEFAULT}}
DEV_TESTS_COUNT="${DEV_MODE_COUNT:-0}"
Loading

0 comments on commit 59997f1

Please sign in to comment.