fix: 统一前端Harbor镜像发布与拉取部署

This commit is contained in:
Yvan
2026-11-05 13:08:56 +08:00
parent 5f6e893457
commit af2a2a44b3
13 changed files with 201 additions and 61 deletions
+3 -1
View File
@@ -4,12 +4,14 @@ import fs from 'node:fs'
import path from 'node:path'
import os from 'node:os'
import { execFileSync } from 'node:child_process'
import { frontendRoot, validTag, shellQuote, deploymentTarget, validateEntries, inspectPackage, bashExecutable } from './release.mjs'
import { frontendRoot, frontendImage, validTag, shellQuote, deploymentTarget, validateEntries, inspectPackage, bashExecutable } from './release.mjs'
import { installScript } from './deploy-test.mjs'
test('release and SSH inputs reject paths, options and shell injection', () => {
for (const value of ['', '../release', '-latest', 'a;touch x', 'a\nother']) assert.throws(() => validTag(value))
assert.equal(validTag('a846bd90-rc.1'), 'a846bd90-rc.1')
assert.equal(frontendImage('a846bd90-rc.1'), 'harbor.fuhua91.com/game/sw2:a846bd90-rc.1')
assert.throws(() => frontendImage('../other'))
for (const args of [{ host: '-oProxyCommand=id' }, { user: 'root;id' }, { directory: '/' }, { directory: '/www/../etc' }, { port: '65536' }]) assert.throws(() => deploymentTarget(args))
assert.equal(shellQuote("a'b$(id)"), "'a'\\''b$(id)'")
assert.equal(deploymentTarget().base, '/www/wwwroot/sw2.fuhua91.com')