mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
seaweed-block: release gate fixes on top of the scenario cleanup (#13419)
* seaweed-block: release gate .ps1 runs swblock from PATH without a runner checkout RunnerRoot became mandatory when its lab default was dropped, so the script could no longer fall back to the swblock binary on PATH the way the .sh does when SWBLOCK_RUNNER_ROOT is unset. Default it to empty and check for an empty value before Test-Path, which rejects an empty path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-block: release gate refuses an artifact root with whitespace The kept scenarios substitute artifact_root into shell commands without quotes, including rm -rf of the run directory, so a path with a space would split into separate arguments. Refuse such a value up front in both release-gate scripts and say so in the settings table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-block: drop the removed testops/suites/ from the authoring page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-block: NVMe/TCP chains import images with the node-side key The image import runs build-alpha-images.sh on node-a, which ssh's from there to the import nodes, but these two chains passed ssh_key, the controller-side key. Pass node_ssh_key like the node-loss chain does; left empty, ssh falls back to node-a's default identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-block: scenario headers list every setting a run needs The expected-invocation comments still showed only product_root and ssh_key, but each chain now also reads node_host, node_user and artifact_root and leaves them empty by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-block: testops README names the lab-only scenario and the import chains helm-multi-volume-rf3-app-spread-failover-chain.yaml still names lab hosts, so the 'no scenario names a host' line now excepts it. The run example used <...> placeholders, which bash reads as redirections. The import_nodes and node_ssh_key rows now name the chains that read them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-block: test the release gate's artifact-root whitespace check Runs the .sh with a space and a tab in SW_BLOCK_NODE_ARTIFACT_ROOT and expects it to stop before creating the artifact directory, and checks that the .ps1 refuses such a value before its first New-Item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
41cfa99fea
commit
aeaa2ab8ce
14 files changed
+99
-13
No files matched your search
@@ -85,7 +85,6 @@ Prefer gates that compare at least two surfaces:
|
||||
| Area | Path |
|
||||
|---|---|
|
||||
| scenario definitions | `testops/scenarios/` |
|
||||
| suites | `testops/suites/` |
|
||||
| runner contracts | `internal/docs/ref/testops-runner-binary-contract.md` |
|
||||
| control/data contract | `internal/docs/ref/testops-control-data-contract.md` |
|
||||
| QA sign-offs | `internal/docs/qa-assignments/` |
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package scripts_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReleaseGateRefusesArtifactRootWithWhitespace(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("bash script")
|
||||
}
|
||||
bash, err := exec.LookPath("bash")
|
||||
if err != nil {
|
||||
t.Skip("bash not available")
|
||||
}
|
||||
script := filepath.Join(repoRoot(t), "scripts", "testops-run-protocol-release-gate.sh")
|
||||
for _, root := range []string{"/srv/test artifacts", "/srv/test\tartifacts"} {
|
||||
artifacts := filepath.Join(t.TempDir(), "gate")
|
||||
cmd := exec.Command(bash, script, t.TempDir())
|
||||
cmd.Env = append(os.Environ(),
|
||||
"SW_BLOCK_SSH_KEY=/k",
|
||||
"SW_BLOCK_NODE_HOST=192.0.2.10",
|
||||
"SW_BLOCK_NODE_USER=tester",
|
||||
"SW_BLOCK_NODE_ARTIFACT_ROOT="+root,
|
||||
"SW_BLOCK_ARTIFACT_DIR="+artifacts,
|
||||
"SWBLOCK_CMD=/nonexistent-swblock",
|
||||
)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err == nil {
|
||||
t.Fatalf("artifact root %q accepted; output:\n%s", root, out)
|
||||
}
|
||||
if !strings.Contains(string(out), "must not contain whitespace") {
|
||||
t.Fatalf("artifact root %q: unexpected output:\n%s", root, out)
|
||||
}
|
||||
if _, err := os.Stat(artifacts); !os.IsNotExist(err) {
|
||||
t.Fatalf("artifact root %q: %s created before the check (stat err %v)", root, artifacts, err)
|
||||
}
|
||||
}
|
||||
|
||||
ps, err := os.ReadFile(filepath.Join(repoRoot(t), "scripts", "testops-run-protocol-release-gate.ps1"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check := strings.Index(string(ps), `$NodeArtifactRoot -match '\s'`)
|
||||
mkdir := strings.Index(string(ps), "New-Item -ItemType Directory")
|
||||
if check < 0 || mkdir < 0 || check > mkdir {
|
||||
t.Fatalf(".ps1 must refuse a NodeArtifactRoot with whitespace before it creates directories (check at %d, New-Item at %d)", check, mkdir)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
param(
|
||||
[string]$ProductRepoRoot = (Get-Location).Path,
|
||||
[Parameter(Mandatory = $true)][string]$RunnerRoot,
|
||||
[string]$RunnerRoot = "",
|
||||
[string]$RemoteProductRoot = "/tmp/seaweed-block-nvme-p4l",
|
||||
[Parameter(Mandatory = $true)][string]$SshKey,
|
||||
[Parameter(Mandatory = $true)][string]$NodeHost,
|
||||
@@ -12,6 +12,11 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# The scenarios put artifact_root into shell commands unquoted.
|
||||
if ($NodeArtifactRoot -match '\s') {
|
||||
throw "NodeArtifactRoot must not contain whitespace: $NodeArtifactRoot"
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($RunId)) {
|
||||
$RunId = "protocol-release-gate-" + (Get-Date).ToUniversalTime().ToString("yyyyMMddTHHmmssZ")
|
||||
}
|
||||
@@ -26,7 +31,7 @@ $ProductCommit = "unknown"
|
||||
$RunnerCommit = "unknown"
|
||||
try { $ProductCommit = (& git -C $ProductRepoRoot rev-parse HEAD).Trim() } catch {}
|
||||
try {
|
||||
if (Test-Path $RunnerRoot) {
|
||||
if ($RunnerRoot -and (Test-Path $RunnerRoot)) {
|
||||
$RunnerCommit = (& git -C $RunnerRoot rev-parse HEAD).Trim()
|
||||
}
|
||||
} catch {}
|
||||
@@ -212,7 +217,7 @@ function Invoke-Chain {
|
||||
Set-Content -Path (Join-Path $stepDir "swblock.command.txt") -Value ("swblock " + ($swblockArgs -join " "))
|
||||
$rc = 0
|
||||
try {
|
||||
if (Test-Path $RunnerRoot) {
|
||||
if ($RunnerRoot -and (Test-Path $RunnerRoot)) {
|
||||
$rc = Invoke-NativeRedirect -FilePath "go" -Arguments (@("run", "./cmd/swblock") + $swblockArgs) -WorkingDirectory $RunnerRoot -StdoutPath $stdout -StderrPath $stderr
|
||||
} else {
|
||||
$rc = Invoke-NativeRedirect -FilePath "swblock" -Arguments $swblockArgs -WorkingDirectory $ProductRepoRoot -StdoutPath $stdout -StderrPath $stderr
|
||||
|
||||
@@ -11,6 +11,11 @@ SSH_KEY="${SW_BLOCK_SSH_KEY:?set SW_BLOCK_SSH_KEY to the private key for the tes
|
||||
NODE_HOST="${SW_BLOCK_NODE_HOST:?set SW_BLOCK_NODE_HOST to the test node address}"
|
||||
NODE_USER="${SW_BLOCK_NODE_USER:?set SW_BLOCK_NODE_USER to the ssh user on the test node}"
|
||||
NODE_ARTIFACT_ROOT="${SW_BLOCK_NODE_ARTIFACT_ROOT:?set SW_BLOCK_NODE_ARTIFACT_ROOT to the shared artifact directory on the test node}"
|
||||
# The scenarios put artifact_root into shell commands unquoted.
|
||||
if [[ "$NODE_ARTIFACT_ROOT" =~ [[:space:]] ]]; then
|
||||
echo "SW_BLOCK_NODE_ARTIFACT_ROOT must not contain whitespace: $NODE_ARTIFACT_ROOT" >&2
|
||||
exit 2
|
||||
fi
|
||||
SWBLOCK_CMD="${SWBLOCK_CMD:-swblock}"
|
||||
SWBLOCK_RUNNER_ROOT="${SWBLOCK_RUNNER_ROOT:-}"
|
||||
SUITE_STARTED_EPOCH="$(date -u +%s)"
|
||||
|
||||
@@ -18,8 +18,9 @@ not from this repository. Check a scenario before running it:
|
||||
swblock validate testops/scenarios/nvme-p5-protocol-component-gate.yaml
|
||||
```
|
||||
|
||||
No scenario names a host, user, key or share. Each one reads them from its `env`
|
||||
block, where they are empty, so set every one on the command line:
|
||||
Apart from `helm-multi-volume-rf3-app-spread-failover-chain.yaml`, which still targets
|
||||
the project's lab, no scenario names a host, user, key or share. Each one reads them
|
||||
from its `env` block, where they are empty, so set every one on the command line:
|
||||
|
||||
| Setting | Meaning |
|
||||
| --- | --- |
|
||||
@@ -27,15 +28,15 @@ block, where they are empty, so set every one on the command line:
|
||||
| `node_host` | address of the test node |
|
||||
| `node_user` | ssh user on the test node |
|
||||
| `ssh_key` | private key for `node_user`, on the controller |
|
||||
| `artifact_root` | shared directory for run artifacts, as the test node sees it |
|
||||
| `import_nodes` | extra k3s nodes for the image import (the two NVMe/TCP status chains) |
|
||||
| `node_ssh_key` | key path on the test node for the image import (the node-loss chain) |
|
||||
| `artifact_root` | shared directory for run artifacts, as the test node sees it; no whitespace, since commands use it unquoted |
|
||||
| `import_nodes` | every other k3s node, for the image import (`nvme-tcp-status-surface-evidence-chain`, `nvme-tcp-cross-node-multivolume-lifecycle-soak-chain`); without it only the test node gets the images |
|
||||
| `node_ssh_key` | key path on the test node for the image import (those two chains and `node-loss-survival-rf3-reattach-chain`) |
|
||||
|
||||
```bash
|
||||
swblock run \
|
||||
-env product_root=/path/to/seaweed-block \
|
||||
-env node_host=<node address> \
|
||||
-env node_user=<user> \
|
||||
-env node_host=192.0.2.10 \
|
||||
-env node_user=tester \
|
||||
-env ssh_key=/path/to/key \
|
||||
-env artifact_root=/path/to/shared/artifacts \
|
||||
testops/scenarios/nvme-p5-protocol-component-gate.yaml
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/activation-day1-install-chain.yaml
|
||||
|
||||
name: activation-day1-install-chain
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/iscsi-p6-alua-failover-chain.yaml
|
||||
|
||||
name: iscsi-p6-alua-failover-chain
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/iscsi-p8-compat-soak-chain.yaml
|
||||
|
||||
name: iscsi-p8-compat-soak-chain
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/light-use-first-volume-failure-bundle-chain.yaml
|
||||
|
||||
name: light-use-first-volume-failure-bundle-chain
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/nvme-p4-multipath-failover-chain.yaml
|
||||
|
||||
name: nvme-p4-multipath-failover-chain
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/nvme-p5-csi-protocol-chain.yaml
|
||||
|
||||
name: nvme-p5-csi-protocol-chain
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# swblock run \
|
||||
# -env product_root=/path/to/seaweed_block/on/node-a \
|
||||
# -env ssh_key=/path/to/ssh/key/on/controller \
|
||||
# -env node_host=192.0.2.10 \
|
||||
# -env node_user=tester \
|
||||
# -env artifact_root=/path/to/shared/artifacts \
|
||||
# testops/scenarios/nvme-p5-protocol-component-gate.yaml
|
||||
|
||||
name: nvme-p5-protocol-component-gate
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ env:
|
||||
node_user: "" # ssh user on the test node; set with -env node_user=<user>
|
||||
artifact_root: "" # shared artifact directory; set with -env artifact_root=<path>
|
||||
import_nodes: "" # extra k3s nodes for the image import; set with -env import_nodes=<addresses>
|
||||
node_ssh_key: "" # key path on the test node for the image import; set with -env node_ssh_key=<path>
|
||||
helm_release: "sw-block"
|
||||
helm_namespace: "kube-system"
|
||||
volume_count: "2"
|
||||
@@ -43,7 +44,7 @@ phases:
|
||||
env.SW_BLOCK_IMPORT_K3S: "1"
|
||||
env.SW_BLOCK_IMPORT_K3S_NODES: "{{ import_nodes }}"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_USER: "{{ node_user }}"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "{{ ssh_key }}"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "{{ node_ssh_key }}"
|
||||
env.SW_BLOCK_ARTIFACT_DIR: "{{ artifact_root }}/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/build"
|
||||
- action: grep_log
|
||||
node: node-a
|
||||
|
||||
@@ -8,6 +8,7 @@ env:
|
||||
node_user: "" # ssh user on the test node; set with -env node_user=<user>
|
||||
artifact_root: "" # shared artifact directory; set with -env artifact_root=<path>
|
||||
import_nodes: "" # extra k3s nodes for the image import; set with -env import_nodes=<addresses>
|
||||
node_ssh_key: "" # key path on the test node for the image import; set with -env node_ssh_key=<path>
|
||||
helm_release: "sw-block"
|
||||
helm_namespace: "kube-system"
|
||||
volume_count: "2"
|
||||
@@ -42,7 +43,7 @@ phases:
|
||||
env.SW_BLOCK_IMPORT_K3S: "1"
|
||||
env.SW_BLOCK_IMPORT_K3S_NODES: "{{ import_nodes }}"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_USER: "{{ node_user }}"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "{{ ssh_key }}"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "{{ node_ssh_key }}"
|
||||
env.SW_BLOCK_ARTIFACT_DIR: "{{ artifact_root }}/g15d-k8s/{{ run_id }}-phase109-nvme-status/build"
|
||||
- action: grep_log
|
||||
node: node-a
|
||||
|
||||
Reference in new issue
Block a user