mattermost-mobile-upstream/.github/actions/provision-e2e-servers/action.yml
yasser khan ebc91be6e0
E2E: run shared channels tests on CI, demo plugin v0.12.2 on all full-suite servers (#10267)
* E2E: run the shared channels tests on CI instead of skipping them

CI servers now boot with Shared Channels running (matterwick#106), so the suite runs there and fails setup if the service is missing.

* E2E: run demo plugin v0.12.2 in DialogOnlyMode

Moves the demo plugin to v0.12.2 and writes DialogOnlyMode: true into its settings entry before it is installed on server B, so it no longer creates a demo user and channels or posts in every team on every server event. Only /dialog is kept, which is all the dialog specs use. The entry still keeps an older build on a reused server out of config saves.

* E2E: give a neutral reason when Shared Channels is unavailable

hasSharedChannels is false both when the license lacks Shared Channels and when GET /remotecluster fails; point to the globalSetup log line that names the actual reason.

* E2E: run the read-only dialog specs on the pool servers

With demo plugin v0.12.2 in DialogOnlyMode it no longer posts in every team, so it is installed on every full-suite server (pool A and mutation B) instead of B only. interactive_dialog_plugin and interactive_dialog_collapsible change no server-wide state, so they leave the mutation manifest and run on the pool. interactive_dialog_mobile_upload_disabled stays on B. The shared SITE_3 and smoke servers still get no demo plugin, and CMT still rejects a site 2 that is also a pool site 1.

* E2E: remove unused demo plugin helpers

apiUploadAndEnablePlugin and apiClearDemoPluginFileUploadKV had no callers (the KV route does not exist). Provisioning installs the plugin, so the install plan they used goes too.

* fix(e2e): say why a spec has no result (#10280)

* chore: Update NOTICE.txt file with updated dependencies (#10277)

Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>

* fix(e2e): say whether a spec with no result had a silent shard or a stopped one

A spec that produced no result now says which: no spec of its shard reported
(the shard ran or uploaded nothing), or other specs of its shard reported (its
Jest process stopped before reaching this spec). E2E triage re-runs the first
and judges the second by the spec's own history. The shard of each spec comes
from the generate-specs matrix rows; without them the old wording stays.

---------

Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>
2026-10-27 11:42:07 +05:30

121 lines
4.6 KiB
YAML

# Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
# See LICENSE.txt for license information.
name: Provision E2E test servers
description: >-
Validate Matterwick server URLs, cache the demo-plugin fixture, and run
detox provision (license + plugins) on each unique URL. The demo plugin is
installed only on demo-plugin-server-urls; every other URL is provisioned
without it. PR E2E and CMT share this so dialog/plugin specs do not assume a
pre-provisioned server.
inputs:
server-urls:
description: Newline-separated HTTPS Mattermost test server URLs
required: true
demo-plugin-server-urls:
description: Newline-separated subset of server-urls that get the demo plugin (the full-suite pool servers A and mutation servers B); empty means none
required: false
default: ''
runs:
using: composite
steps:
- name: Validate server URLs
env:
SERVER_URLS: ${{ inputs.server-urls }}
DEMO_PLUGIN_SERVER_URLS: ${{ inputs.demo-plugin-server-urls }}
run: |
set -euo pipefail
validate_url() {
local url="$1" label="$2"
if [ -z "$url" ]; then return 0; fi
if [[ "$url" =~ [[:space:]] ]]; then
echo "::error::$label contains whitespace: $url"
exit 1
fi
if [[ ! "$url" =~ ^https:// ]]; then
echo "::error::$label must use HTTPS: $url"
exit 1
fi
hostname=$(python3 -c 'import sys; from urllib.parse import urlparse; print(urlparse(sys.argv[1]).hostname or "")' "$url" | tr '[:upper:]' '[:lower:]')
if echo "$hostname" | grep -qE '^(127\.|10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.|0\.|localhost|::1$|::ffff:|fe80:)'; then
echo "::error::$label points to a private/internal address: $hostname"
exit 1
fi
if ! echo "$hostname" | grep -qE '\.(cloud\.mattermost\.com|test\.mattermost\.cloud|mattermost\.com|mattermost\.cloud)$'; then
echo "::error::$label domain not in allowlist: $hostname"
exit 1
fi
echo "✓ $label validated: $hostname"
}
index=0
while IFS= read -r url; do
[ -z "$url" ] && continue
index=$((index + 1))
validate_url "$url" "SERVER_URL[$index]"
done <<< "$SERVER_URLS"
if [ "$index" -eq 0 ]; then
echo "::error::No server URLs provided to provision-e2e-servers"
exit 1
fi
while IFS= read -r url; do
[ -z "$url" ] && continue
if ! grep -Fxq -- "$url" <<< "$SERVER_URLS"; then
echo "::error::demo-plugin-server-urls entry is not in server-urls: $url"
exit 1
fi
done <<< "$DEMO_PLUGIN_SERVER_URLS"
shell: bash
# Runner (not the Mattermost origin) fetches the tarball. install_from_url
# through Cloudflare 524s and wedges config/patch + uploads for the shard.
- name: Cache demo plugin fixture
id: demo-plugin-cache
if: inputs.demo-plugin-server-urls != ''
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: detox/e2e/support/fixtures/mattermost-plugin-demo-v0.12.2-linux-amd64.tar.gz
key: mattermost-plugin-demo-linux-amd64-v0.12.2
- name: Download demo plugin fixture
if: inputs.demo-plugin-server-urls != '' && steps.demo-plugin-cache.outputs.cache-hit != 'true'
run: |
mkdir -p detox/e2e/support/fixtures
curl -fsSL -o detox/e2e/support/fixtures/mattermost-plugin-demo-v0.12.2-linux-amd64.tar.gz \
"https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.12.2/mattermost-plugin-demo-v0.12.2-linux-amd64.tar.gz"
ls -lh detox/e2e/support/fixtures/mattermost-plugin-demo-v0.12.2-linux-amd64.tar.gz
shell: bash
- name: Provision servers (license + plugins)
env:
SERVER_URLS: ${{ inputs.server-urls }}
DEMO_PLUGIN_SERVER_URLS: ${{ inputs.demo-plugin-server-urls }}
run: |
set -euo pipefail
cd detox
npm ci --prefer-offline --no-audit --no-fund
declare -A provisioned=()
while IFS= read -r url; do
[ -z "$url" ] && continue
if [ -z "${provisioned[$url]+x}" ]; then
if grep -Fxq -- "$url" <<< "$DEMO_PLUGIN_SERVER_URLS"; then
demo_flag=--demo-plugin
else
demo_flag=--no-demo-plugin
fi
echo "--- Provisioning $url ($demo_flag) ---"
npm run provision -- "$url" "$demo_flag"
provisioned["$url"]=1
fi
done <<< "$SERVER_URLS"
shell: bash