修复发布构建本机路径泄漏并补齐产物检查
This commit is contained in:
1 parent
ba6c6d13e5
commit
a21240109a
13 files changed
+436
-28
No files matched your search
@@ -21,13 +21,25 @@ func (items *stringList) Set(value string) error {
|
||||
}
|
||||
|
||||
func main() {
|
||||
var executables stringList
|
||||
var executables, binaries, forbiddenPaths stringList
|
||||
source := flag.String("source", "", "发布源目录")
|
||||
output := flag.String("output", "", "发布归档路径")
|
||||
format := flag.String("format", "", "归档格式:tar.gz 或 zip")
|
||||
verifyOnly := flag.Bool("verify-only", false, "仅检查路径裁剪和本机路径残留")
|
||||
flag.Var(&executables, "executable", "需要写入 0755 权限的相对路径,可重复指定")
|
||||
flag.Var(&binaries, "binary", "需要检查路径裁剪的二进制相对路径,可重复指定")
|
||||
flag.Var(&forbiddenPaths, "forbid-path", "不得写入产物的本机构建路径,可重复指定")
|
||||
flag.Parse()
|
||||
|
||||
if *verifyOnly {
|
||||
if err := releasearchive.Verify(*source, binaries, forbiddenPaths); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "发布路径检查失败:"+err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("发布路径检查通过")
|
||||
return
|
||||
}
|
||||
|
||||
if err := releasearchive.Create(releasearchive.Options{
|
||||
Source: *source, Destination: *output, Format: releasearchive.Format(*format), Executables: executables,
|
||||
}); err != nil {
|
||||
|
||||
Reference in new issue
Block a user