aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-03 00:21:05 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-11-03 16:32:53 +0800
commit3b62c145f8d699767e13770d1bb21d07c2ba9b46 (patch)
tree341fbd27e33b08431a6b950f009d6230d502fd3e /build
parent1b73c79234a1597f1f8b11cff5e01b935f6817a2 (diff)
downloadgo-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.tar
go-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.tar.gz
go-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.tar.bz2
go-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.tar.lz
go-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.tar.xz
go-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.tar.zst
go-tangerine-3b62c145f8d699767e13770d1bb21d07c2ba9b46.zip
travis, build: implement uploading archives to azure
Diffstat (limited to 'build')
-rw-r--r--build/ci.go56
1 files changed, 47 insertions, 9 deletions
diff --git a/build/ci.go b/build/ci.go
index 3dca47fad..1a7cf6f08 100644
--- a/build/ci.go
+++ b/build/ci.go
@@ -23,12 +23,12 @@ Usage: go run ci.go <command> <command flags/arguments>
Available commands are:
- install [ packages... ] -- builds packages and executables
- test [ -coverage ] [ -vet ] [ packages... ] -- runs the tests
- archive [ -type zip|tar ] -- archives build artefacts
- importkeys -- imports signing keys from env
- debsrc [ -sign key-id ] [ -upload dest ] -- creates a debian source package
- xgo [ options ] -- cross builds according to options
+ install [ packages... ] -- builds packages and executables
+ test [ -coverage ] [ -vet ] [ packages... ] -- runs the tests
+ archive [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
+ importkeys -- imports signing keys from env
+ debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
+ xgo [ options ] -- cross builds according to options
For all commands, -n prevents execution of external programs (dry run mode).
@@ -49,7 +49,7 @@ import (
"strings"
"time"
- "../internal/build"
+ "github.com/ethereum/go-ethereum/internal/build"
)
var (
@@ -239,8 +239,10 @@ func doTest(cmdline []string) {
func doArchive(cmdline []string) {
var (
- atype = flag.String("type", "zip", "Type of archive to write (zip|tar)")
- ext string
+ atype = flag.String("type", "zip", "Type of archive to write (zip|tar)")
+ signer = flag.String("signer", "", `Environment variable holding the signing key (e.g. LINUX_SIGNING_KEY)`)
+ upload = flag.String("upload", "", `Destination to upload the archives (usually "gethstore/builds")`)
+ ext string
)
flag.CommandLine.Parse(cmdline)
switch *atype {
@@ -262,6 +264,12 @@ func doArchive(cmdline []string) {
if err := build.WriteArchive("geth-alltools-"+base, ext, allToolsArchiveFiles); err != nil {
log.Fatal(err)
}
+
+ for _, archive := range []string{"geth-" + base + ext, "geth-alltools-" + base + ext} {
+ if err := archiveUpload(archive, *upload, *signer); err != nil {
+ log.Fatal(err)
+ }
+ }
}
func archiveBasename(env build.Environment) string {
@@ -274,6 +282,36 @@ func archiveBasename(env build.Environment) string {
return archive
}
+func archiveUpload(archive string, blobstore string, signer string) error {
+ // If signing was requested, generate the signature files
+ if signer != "" {
+ pgpkey, err := base64.StdEncoding.DecodeString(os.Getenv(signer))
+ if err != nil {
+ return fmt.Errorf("invalid base64 %s", signer)
+ }
+ if err := build.PGPSignFile(archive, archive+".asc", string(pgpkey)); err != nil {
+ return err
+ }
+ }
+ // If uploading to Azure was requested, push the archive possibly with its signature
+ if blobstore != "" {
+ auth := build.AzureBlobstoreConfig{
+ Account: strings.Split(blobstore, "/")[0],
+ Token: os.Getenv("AZURE_BLOBSTORE_TOKEN"),
+ Container: strings.SplitN(blobstore, "/", 2)[1],
+ }
+ if err := build.AzureBlobstoreUpload(archive, archive, auth); err != nil {
+ return err
+ }
+ if signer != "" {
+ if err := build.AzureBlobstoreUpload(archive+".asc", archive+".asc", auth); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
+
// skips archiving for some build configurations.
func maybeSkipArchive(env build.Environment) {
if env.IsPullRequest {