Skip to content

Commit bae1878

Browse files
committed
add archive function for keeper
1 parent 485de9c commit bae1878

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

build/ci.go

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Available commands are:
3232
test [ -coverage ] [ packages... ] -- runs the tests
3333
3434
keeper [ -dlgo ]
35+
keeper-archive [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ]
3536
3637
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
3738
importkeys -- imports signing keys from env
@@ -82,11 +83,7 @@ var (
8283
executablePath("clef"),
8384
}
8485

85-
keeperArchiveFiles = []string{
86-
"COPYING",
87-
executablePath("keeper"),
88-
}
89-
86+
// Keeper build targets with their configurations
9087
keeperTargets = []struct {
9188
Name string
9289
GOOS string
@@ -203,6 +200,8 @@ func main() {
203200
doSanityCheck()
204201
case "keeper":
205202
doInstallKeeper(os.Args[2:])
203+
case "keeper-archive":
204+
doKeeperArchive(os.Args[2:])
206205
default:
207206
log.Fatal("unknown command ", os.Args[1])
208207
}
@@ -660,6 +659,32 @@ func doArchive(cmdline []string) {
660659
}
661660
}
662661

662+
func doKeeperArchive(cmdline []string) {
663+
var (
664+
signer = flag.String("signer", "", `Environment variable holding the signing key (e.g. LINUX_SIGNING_KEY)`)
665+
signify = flag.String("signify", "", `Environment variable holding the signify key (e.g. LINUX_SIGNIFY_KEY)`)
666+
upload = flag.String("upload", "", `Destination to upload the archives (usually "gethstore/builds")`)
667+
)
668+
flag.CommandLine.Parse(cmdline)
669+
670+
var (
671+
env = build.Env()
672+
vsn = version.Archive(env.Commit)
673+
keeper = "keeper-" + vsn + ".tar.gz"
674+
)
675+
maybeSkipArchive(env)
676+
files := []string{"COPYING"}
677+
for _, target := range keeperTargets {
678+
files = append(files, executablePath(fmt.Sprintf("keeper-%s", target.Name)))
679+
}
680+
if err := build.WriteArchive(keeper, files); err != nil {
681+
log.Fatal(err)
682+
}
683+
if err := archiveUpload(keeper, *upload, *signer, *signify); err != nil {
684+
log.Fatal(err)
685+
}
686+
}
687+
663688
func archiveBasename(arch string, archiveVersion string) string {
664689
platform := runtime.GOOS + "-" + arch
665690
if arch == "arm" {

master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 8a19582c8d939e62cdb8a5172779076b9d71902c

pr-review

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit b02b70ea4ae4ebd5f2248b144e09662d1b89f795

0 commit comments

Comments
 (0)