Enhance reporting, add shellcheck (#28240)
* Enhance reporting, add shellcheck --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
dfa1d1027b
Коммит
60b38bb91a
27
e2e-tests/.ci/report.collect.sh
Исполняемый файл
27
e2e-tests/.ci/report.collect.sh
Исполняемый файл
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# SC2034: <variable> appears unused.
|
||||
# https://www.shellcheck.net/wiki/SC2034
|
||||
# shellcheck disable=SC2034
|
||||
# shellcheck disable=SC2086,SC2223
|
||||
|
||||
set -e -u -o pipefail
|
||||
cd "$(dirname "$0")"
|
||||
. .e2erc
|
||||
|
||||
# The collected data will be written to the "e2e-tests/cypress/results/" directory
|
||||
cd ../cypress/
|
||||
if [ ! -d "results/" ]; then
|
||||
mme2e_log "Error: 'results/' directory does not exist. Aborting report data collection." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the Automation Dashboard is used, try to collect run data from it
|
||||
if [ -n "${AUTOMATION_DASHBOARD_URL:-}" ]; then
|
||||
mme2e_log "Automation Dashboard usage detected: retrieving cycle results"
|
||||
# Assume that we're in the cypress dir and that the 'results/' directory exists
|
||||
: ${BUILD_ID:?}
|
||||
AD_CYCLE_FILE="results/ad_cycle.json"
|
||||
AD_SPECS_FILE="results/ad_specs.json"
|
||||
curl -o "$AD_CYCLE_FILE" -fsSL "${AUTOMATION_DASHBOARD_URL}/cycle?build=${BUILD_ID}"
|
||||
curl -o "$AD_SPECS_FILE" -fsSL "${AUTOMATION_DASHBOARD_URL}/executions/specs?cycle_id=$(jq -r .id "$AD_CYCLE_FILE")"
|
||||
fi
|
||||
@@ -11,7 +11,8 @@ for SETTING in \
|
||||
PluginSettings.AutomaticPrepackagedPlugins=true
|
||||
do
|
||||
mme2e_log "Configuring parameter: $SETTING"
|
||||
${MME2E_DC_SERVER} exec -T -- server mmctl --local config set $(tr = ' ' <<<$SETTING)
|
||||
# shellcheck disable=SC2046
|
||||
${MME2E_DC_SERVER} exec -T -- server mmctl --local config set $(tr '=' ' ' <<<$SETTING)
|
||||
done
|
||||
if [ -n "${MM_LICENSE:-}" ]; then
|
||||
# We prefer uploading the license here, instead of setting the env var for the server
|
||||
|
||||
@@ -33,12 +33,12 @@ LOGFILE_SUFFIX="${CI_BASE_URL//\//_}" # Remove slashes from CI_BASE_URL to produ
|
||||
# shellcheck disable=SC2016
|
||||
if ${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress bash -c '[ -n "${AUTOMATION_DASHBOARD_URL}" ]'; then
|
||||
mme2e_log "AUTOMATION_DASHBOARD_URL is set. Using run_test_cycle.js for the cypress run"
|
||||
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node run_test_cycle.js | tee ../cypress/logs/${LOGFILE_SUFFIX}_cypress.log
|
||||
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node run_test_cycle.js | tee "../cypress/logs/${LOGFILE_SUFFIX}_cypress.log"
|
||||
else
|
||||
mme2e_log "AUTOMATION_DASHBOARD_URL is unset. Using run_tests.js for the cypress run"
|
||||
# shellcheck disable=SC2086
|
||||
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node run_tests.js $TEST_FILTER | tee ../cypress/logs/${LOGFILE_SUFFIX}_cypress.log
|
||||
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node run_tests.js $TEST_FILTER | tee "../cypress/logs/${LOGFILE_SUFFIX}_cypress.log"
|
||||
fi
|
||||
|
||||
# Collect server logs
|
||||
${MME2E_DC_SERVER} logs --no-log-prefix -- server >../cypress/logs/${LOGFILE_SUFFIX}_mattermost.log 2>&1
|
||||
${MME2E_DC_SERVER} logs --no-log-prefix -- server > "../cypress/logs/${LOGFILE_SUFFIX}_mattermost.log" 2>&1
|
||||
|
||||
@@ -15,6 +15,7 @@ if ! mme2e_wait_service_healthy server 60 10; then
|
||||
mme2e_log "Mattermost container not healthy, retry attempts exhausted. Giving up." >&2
|
||||
exit 1
|
||||
fi
|
||||
# shellcheck disable=SC2043
|
||||
for MIGRATION in migration_advanced_permissions_phase_2; do
|
||||
# Query explanation: if it doesn't find the migration in the table, there are 0 results and the command fails with a divide-by-zero error. Otherwise the command succeeds
|
||||
MIGRATION_CHECK_COMMAND="${MME2E_DC_SERVER} exec -T -- postgres psql -U mmuser mattermost_test -c \"select 1 / (select count(*) from Systems where name = '${MIGRATION}' and value = 'true');\""
|
||||
|
||||
Ссылка в новой задаче
Block a user