| index 267a64b..a4ad0c3 100644 | ||
| --- a/README.md | ||
| +++ b/README.md | ||
| @@ -143,9 +143,24 @@ Public git mirror: `https://plugingit.scorpiox.net/scorpiox-bot-plugin-nvtop.git | ||
| 143 | 143 | |
| 144 | 144 | ``` |
| 145 | 145 | src/plugin_nvtop.c single-binary implementation (no headers, no deps) |
| 146 | -tests/run.sh 124 offline assertions across all three modes | |
| 146 | +tests/run.sh 130 offline assertions (124 in a bare tree, 130 with the cross builds present) | |
| 147 | 147 | tests/fixtures/ deterministic nvidia / rocm / mock snapshots |
| 148 | 148 | plugin.json catalog metadata for the Bot Market |
| 149 | 149 | ``` |
| 150 | 150 | |
| 151 | 151 | MIT License. Copyright (c) 2026 SCORPIOX INC. |
| 152 | + | |
| 153 | +## Publishing gotchas (learned the hard way) | |
| 154 | + | |
| 155 | +* **The mirror push URL must use the literal user `token`.** | |
| 156 | + `https://token:<PAT>@plugingit.scorpiox.net/<repo>.git` works; | |
| 157 | + `https://<PAT>@host` and `https://x-access-token:<PAT>@host` both fail with | |
| 158 | + `could not read Password`. | |
| 159 | +* **`POST /api?r=repos&name=<repo>` needs a request body and the header | |
| 160 | + `Authorization: token <PAT>`.** Without `--data ''` it answers `400`, and with | |
| 161 | + `-u user:pat` it answers `{"ok":false,"error":"Authentication required"}`. | |
| 162 | +* **plugingit's git handler is HTTP/1.1-only in practice.** Over HTTP/2 the push | |
| 163 | + dies with `PROTOCOL_ERROR` before the request is even read — `git -c | |
| 164 | + http.version=HTTP/1.1 push` is the difference between working and not. | |
| 165 | +* **`release-dist.sh` skips what it cannot build.** Always read the target count | |
| 166 | + in `latest.json`, not the exit code. |
| index 7ebb29f..7ea937c 100755 | ||
| --- a/release-dist.sh | ||
| +++ b/release-dist.sh | ||
| @@ -28,7 +28,7 @@ set -euo pipefail | ||
| 28 | 28 | |
| 29 | 29 | SLUG="nvtop" |
| 30 | 30 | ID="plugin_nvtop" |
| 31 | -VERSION="1.0.0" | |
| 31 | +VERSION="1.0.1" | |
| 32 | 32 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" |
| 33 | 33 | |
| 34 | 34 | ROOT="$(cd "$(dirname "$0")" && pwd)" |
| @@ -346,9 +346,27 @@ PY" || die "index.json merge failed" | ||
| 346 | 346 | say "6/7 plugingit mirror" |
| 347 | 347 | if [ "$DO_MIRROR" -eq 1 ] && [ -f "$PLUGINGIT_TOKEN_FILE" ]; then |
| 348 | 348 | TOKEN=$(tr -d ' \r\n' < "$PLUGINGIT_TOKEN_FILE") |
| 349 | - AUTH_REMOTE=$(printf '%s' "$PLUGINGIT_REMOTE" | sed "s|https://|https://x-access-token:${TOKEN}@|") | |
| 350 | - git push --all "$AUTH_REMOTE" 2>&1 | sed 's/^/ /' || die "mirror push failed" | |
| 351 | - git push --tags "$AUTH_REMOTE" 2>&1 | sed 's/^/ /' || true | |
| 349 | + # The push URL user component must literally be "token" (or empty). A bare | |
| 350 | + # https://<PAT>@host and https://x-access-token:<PAT>@host are both rejected | |
| 351 | + # by plugingit's git handler with "could not read Password". | |
| 352 | + PUSH_URL=$(printf '%s' "$PLUGINGIT_REMOTE" | sed "s|https://|https://token:${TOKEN}@|") | |
| 353 | + API_BASE=$(printf '%s' "$PLUGINGIT_REMOTE" | sed 's|\(https://[^/]*\).*|\1|') | |
| 354 | + | |
| 355 | + mirror_push() { | |
| 356 | + git -c http.version=HTTP/1.1 push --all "$PUSH_URL" 2>&1 | sed 's/^/ /' | |
| 357 | + } | |
| 358 | + if ! mirror_push; then | |
| 359 | + # A first release has no repo on plugingit yet. Create it (auth via the | |
| 360 | + # publisher token) and retry once. The API needs a request body and the | |
| 361 | + # header form "Authorization: token <PAT>". | |
| 362 | + echo " repo missing on plugingit - creating it" | |
| 363 | + curl -sS --http1.1 -X POST -H "Authorization: token $TOKEN" --data '' \ | |
| 364 | + "$API_BASE/api?r=repos&name=$(basename "$PLUGINGIT_REMOTE" .git)" \ | |
| 365 | + | sed 's/^/ /' | |
| 366 | + echo | |
| 367 | + mirror_push || die "mirror push failed" | |
| 368 | + fi | |
| 369 | + git -c http.version=HTTP/1.1 push --tags "$PUSH_URL" 2>&1 | sed 's/^/ /' || true | |
| 352 | 370 | echo " mirrored to $PLUGINGIT_REMOTE" |
| 353 | 371 | else |
| 354 | 372 | echo " skip (no $PLUGINGIT_TOKEN_FILE or --no-mirror)" |
| index cd5645b..dba82c5 100644 | ||
| --- a/src/plugin_nvtop.c | ||
| +++ b/src/plugin_nvtop.c | ||
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 | |
| 59 | 59 | #define PLUGIN_SLUG "nvtop" |
| 60 | 60 | #define PLUGIN_ID "plugin_nvtop" |
| 61 | -#define PLUGIN_VER "1.0.0" | |
| 61 | +#define PLUGIN_VER "1.0.1" | |
| 62 | 62 | |
| 63 | 63 | #define MAX_GPUS 32 |
| 64 | 64 | #define MAX_PROCS 256 |
| index 12c45ee..5d03da4 100755 | ||
| --- a/tests/run.sh | ||
| +++ b/tests/run.sh | ||
| @@ -77,7 +77,7 @@ DESC=$(printf '%s' "$META" | sed 's/.*"desc":"\([^"]*\)".*/\1/') | ||
| 77 | 77 | [ ${#DESC} -le 15 ] && pass "desc length ${#DESC} <= 15 chars" || fail "desc too long (${#DESC})" |
| 78 | 78 | NAME=$(printf '%s' "$META" | sed 's/.*"name":"\([^"]*\)".*/\1/') |
| 79 | 79 | [ "$(printf '%s' "$NAME" | wc -w | tr -d ' ')" -le 1 ] && pass "name is a single word" || fail "name has spaces" |
| 80 | -check "--version prints version" '1.0.0' "$("$BIN" --version)" | |
| 80 | +check "--version prints version" '1.0.1' "$("$BIN" --version)" | |
| 81 | 81 | check "--help is available" 'usage:' "$("$BIN" --help)" |
| 82 | 82 | check "--help documents the mock hook" 'NVTOP_MOCK_CSV' "$("$BIN" --help)" |
| 83 | 83 | META_AUTH=$(BOT_PASSWORD=secret "$BIN" --meta) |
| @@ -226,7 +226,7 @@ assert g["util_gpu"]==44.0 and g["temp_c"]==58 and g["power_w"]==112.0 and g["po | ||
| 226 | 226 | section "mode 2 action=info" |
| 227 | 227 | INFO=$(body "$(QUERY_STRING='action=info' "$BIN")") |
| 228 | 228 | check "info names the plugin" '"plugin":"plugin_nvtop"' "$INFO" |
| 229 | -check "info reports the version" '"version":"1.0.0"' "$INFO" | |
| 229 | +check "info reports the version" '"version":"1.0.1"' "$INFO" | |
| 230 | 230 | check "info lists the probes" 'nvidia-smi' "$INFO" |
| 231 | 231 | check "info lists the mock hook" 'NVTOP_MOCK_CSV' "$INFO" |
| 232 | 232 | check "info advertises zero_network" '"zero_network":true' "$INFO" |
| 233 | 233 |
| index 267a64b..a4ad0c3 100644 | index 267a64b..a4ad0c3 100644 | ||
| --- a/README.md | --- a/README.md | ||
| +++ b/README.md | +++ b/README.md | ||
| @@ -143,9 +143,24 @@ Public git mirror: `https://plugingit.scorpiox.net/scorpiox-bot-plugin-nvtop.git | @@ -143,9 +143,24 @@ Public git mirror: `https://plugingit.scorpiox.net/scorpiox-bot-plugin-nvtop.git | ||
| 143 | 143 | ||
| 144 | ``` | 144 | ``` |
| 145 | src/plugin_nvtop.c single-binary implementation (no headers, no deps) | 145 | src/plugin_nvtop.c single-binary implementation (no headers, no deps) |
| 146 | -tests/run.sh 124 offline assertions across all three modes | 146 | +tests/run.sh 130 offline assertions (124 in a bare tree, 130 with the cross builds present) |
| 147 | tests/fixtures/ deterministic nvidia / rocm / mock snapshots | 147 | tests/fixtures/ deterministic nvidia / rocm / mock snapshots |
| 148 | plugin.json catalog metadata for the Bot Market | 148 | plugin.json catalog metadata for the Bot Market |
| 149 | ``` | 149 | ``` |
| 150 | 150 | ||
| 151 | MIT License. Copyright (c) 2026 SCORPIOX INC. | 151 | MIT License. Copyright (c) 2026 SCORPIOX INC. |
| 152 | + | ||
| 153 | +## Publishing gotchas (learned the hard way) | ||
| 154 | + | ||
| 155 | +* **The mirror push URL must use the literal user `token`.** | ||
| 156 | + `https://token:<PAT>@plugingit.scorpiox.net/<repo>.git` works; | ||
| 157 | + `https://<PAT>@host` and `https://x-access-token:<PAT>@host` both fail with | ||
| 158 | + `could not read Password`. | ||
| 159 | +* **`POST /api?r=repos&name=<repo>` needs a request body and the header | ||
| 160 | + `Authorization: token <PAT>`.** Without `--data ''` it answers `400`, and with | ||
| 161 | + `-u user:pat` it answers `{"ok":false,"error":"Authentication required"}`. | ||
| 162 | +* **plugingit's git handler is HTTP/1.1-only in practice.** Over HTTP/2 the push | ||
| 163 | + dies with `PROTOCOL_ERROR` before the request is even read — `git -c | ||
| 164 | + http.version=HTTP/1.1 push` is the difference between working and not. | ||
| 165 | +* **`release-dist.sh` skips what it cannot build.** Always read the target count | ||
| 166 | + in `latest.json`, not the exit code. |
| index 7ebb29f..7ea937c 100755 | index 7ebb29f..7ea937c 100755 | ||
| --- a/release-dist.sh | --- a/release-dist.sh | ||
| +++ b/release-dist.sh | +++ b/release-dist.sh | ||
| @@ -28,7 +28,7 @@ set -euo pipefail | @@ -28,7 +28,7 @@ set -euo pipefail | ||
| 28 | 28 | ||
| 29 | SLUG="nvtop" | 29 | SLUG="nvtop" |
| 30 | ID="plugin_nvtop" | 30 | ID="plugin_nvtop" |
| 31 | -VERSION="1.0.0" | 31 | +VERSION="1.0.1" |
| 32 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" | 32 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" |
| 33 | 33 | ||
| 34 | ROOT="$(cd "$(dirname "$0")" && pwd)" | 34 | ROOT="$(cd "$(dirname "$0")" && pwd)" |
| @@ -346,9 +346,27 @@ PY" || die "index.json merge failed" | @@ -346,9 +346,27 @@ PY" || die "index.json merge failed" | ||
| 346 | say "6/7 plugingit mirror" | 346 | say "6/7 plugingit mirror" |
| 347 | if [ "$DO_MIRROR" -eq 1 ] && [ -f "$PLUGINGIT_TOKEN_FILE" ]; then | 347 | if [ "$DO_MIRROR" -eq 1 ] && [ -f "$PLUGINGIT_TOKEN_FILE" ]; then |
| 348 | TOKEN=$(tr -d ' \r\n' < "$PLUGINGIT_TOKEN_FILE") | 348 | TOKEN=$(tr -d ' \r\n' < "$PLUGINGIT_TOKEN_FILE") |
| 349 | - AUTH_REMOTE=$(printf '%s' "$PLUGINGIT_REMOTE" | sed "s|https://|https://x-access-token:${TOKEN}@|") | 349 | + # The push URL user component must literally be "token" (or empty). A bare |
| 350 | - git push --all "$AUTH_REMOTE" 2>&1 | sed 's/^/ /' || die "mirror push failed" | 350 | + # https://<PAT>@host and https://x-access-token:<PAT>@host are both rejected |
| 351 | - git push --tags "$AUTH_REMOTE" 2>&1 | sed 's/^/ /' || true | 351 | + # by plugingit's git handler with "could not read Password". |
| 352 | + PUSH_URL=$(printf '%s' "$PLUGINGIT_REMOTE" | sed "s|https://|https://token:${TOKEN}@|") | ||
| 353 | + API_BASE=$(printf '%s' "$PLUGINGIT_REMOTE" | sed 's|\(https://[^/]*\).*|\1|') | ||
| 354 | + | ||
| 355 | + mirror_push() { | ||
| 356 | + git -c http.version=HTTP/1.1 push --all "$PUSH_URL" 2>&1 | sed 's/^/ /' | ||
| 357 | + } | ||
| 358 | + if ! mirror_push; then | ||
| 359 | + # A first release has no repo on plugingit yet. Create it (auth via the | ||
| 360 | + # publisher token) and retry once. The API needs a request body and the | ||
| 361 | + # header form "Authorization: token <PAT>". | ||
| 362 | + echo " repo missing on plugingit - creating it" | ||
| 363 | + curl -sS --http1.1 -X POST -H "Authorization: token $TOKEN" --data '' \ | ||
| 364 | + "$API_BASE/api?r=repos&name=$(basename "$PLUGINGIT_REMOTE" .git)" \ | ||
| 365 | + | sed 's/^/ /' | ||
| 366 | + echo | ||
| 367 | + mirror_push || die "mirror push failed" | ||
| 368 | + fi | ||
| 369 | + git -c http.version=HTTP/1.1 push --tags "$PUSH_URL" 2>&1 | sed 's/^/ /' || true | ||
| 352 | echo " mirrored to $PLUGINGIT_REMOTE" | 370 | echo " mirrored to $PLUGINGIT_REMOTE" |
| 353 | else | 371 | else |
| 354 | echo " skip (no $PLUGINGIT_TOKEN_FILE or --no-mirror)" | 372 | echo " skip (no $PLUGINGIT_TOKEN_FILE or --no-mirror)" |
| index cd5645b..dba82c5 100644 | index cd5645b..dba82c5 100644 | ||
| --- a/src/plugin_nvtop.c | --- a/src/plugin_nvtop.c | ||
| +++ b/src/plugin_nvtop.c | +++ b/src/plugin_nvtop.c | ||
| @@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
| 58 | 58 | ||
| 59 | #define PLUGIN_SLUG "nvtop" | 59 | #define PLUGIN_SLUG "nvtop" |
| 60 | #define PLUGIN_ID "plugin_nvtop" | 60 | #define PLUGIN_ID "plugin_nvtop" |
| 61 | -#define PLUGIN_VER "1.0.0" | 61 | +#define PLUGIN_VER "1.0.1" |
| 62 | 62 | ||
| 63 | #define MAX_GPUS 32 | 63 | #define MAX_GPUS 32 |
| 64 | #define MAX_PROCS 256 | 64 | #define MAX_PROCS 256 |
| index 12c45ee..5d03da4 100755 | index 12c45ee..5d03da4 100755 | ||
| --- a/tests/run.sh | --- a/tests/run.sh | ||
| +++ b/tests/run.sh | +++ b/tests/run.sh | ||
| @@ -77,7 +77,7 @@ DESC=$(printf '%s' "$META" | sed 's/.*"desc":"\([^"]*\)".*/\1/') | @@ -77,7 +77,7 @@ DESC=$(printf '%s' "$META" | sed 's/.*"desc":"\([^"]*\)".*/\1/') | ||
| 77 | [ ${#DESC} -le 15 ] && pass "desc length ${#DESC} <= 15 chars" || fail "desc too long (${#DESC})" | 77 | [ ${#DESC} -le 15 ] && pass "desc length ${#DESC} <= 15 chars" || fail "desc too long (${#DESC})" |
| 78 | NAME=$(printf '%s' "$META" | sed 's/.*"name":"\([^"]*\)".*/\1/') | 78 | NAME=$(printf '%s' "$META" | sed 's/.*"name":"\([^"]*\)".*/\1/') |
| 79 | [ "$(printf '%s' "$NAME" | wc -w | tr -d ' ')" -le 1 ] && pass "name is a single word" || fail "name has spaces" | 79 | [ "$(printf '%s' "$NAME" | wc -w | tr -d ' ')" -le 1 ] && pass "name is a single word" || fail "name has spaces" |
| 80 | -check "--version prints version" '1.0.0' "$("$BIN" --version)" | 80 | +check "--version prints version" '1.0.1' "$("$BIN" --version)" |
| 81 | check "--help is available" 'usage:' "$("$BIN" --help)" | 81 | check "--help is available" 'usage:' "$("$BIN" --help)" |
| 82 | check "--help documents the mock hook" 'NVTOP_MOCK_CSV' "$("$BIN" --help)" | 82 | check "--help documents the mock hook" 'NVTOP_MOCK_CSV' "$("$BIN" --help)" |
| 83 | META_AUTH=$(BOT_PASSWORD=secret "$BIN" --meta) | 83 | META_AUTH=$(BOT_PASSWORD=secret "$BIN" --meta) |
| @@ -226,7 +226,7 @@ assert g["util_gpu"]==44.0 and g["temp_c"]==58 and g["power_w"]==112.0 and g["po | @@ -226,7 +226,7 @@ assert g["util_gpu"]==44.0 and g["temp_c"]==58 and g["power_w"]==112.0 and g["po | ||
| 226 | section "mode 2 action=info" | 226 | section "mode 2 action=info" |
| 227 | INFO=$(body "$(QUERY_STRING='action=info' "$BIN")") | 227 | INFO=$(body "$(QUERY_STRING='action=info' "$BIN")") |
| 228 | check "info names the plugin" '"plugin":"plugin_nvtop"' "$INFO" | 228 | check "info names the plugin" '"plugin":"plugin_nvtop"' "$INFO" |
| 229 | -check "info reports the version" '"version":"1.0.0"' "$INFO" | 229 | +check "info reports the version" '"version":"1.0.1"' "$INFO" |
| 230 | check "info lists the probes" 'nvidia-smi' "$INFO" | 230 | check "info lists the probes" 'nvidia-smi' "$INFO" |
| 231 | check "info lists the mock hook" 'NVTOP_MOCK_CSV' "$INFO" | 231 | check "info lists the mock hook" 'NVTOP_MOCK_CSV' "$INFO" |
| 232 | check "info advertises zero_network" '"zero_network":true' "$INFO" | 232 | check "info advertises zero_network" '"zero_network":true' "$INFO" |
| 233 | 233 |