forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#3226 from karalabe/azure-gethstore
travis, build: implement uploading archives to azure
- Loading branch information
Showing
60 changed files
with
11,437 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ matrix: | |
- os: linux | ||
dist: trusty | ||
go: 1.5.4 | ||
env: | ||
- GO15VENDOREXPERIMENT=1 | ||
- os: linux | ||
dist: trusty | ||
go: 1.6.2 | ||
|
@@ -15,27 +17,43 @@ matrix: | |
- os: osx | ||
go: 1.7 | ||
|
||
# This builder does the PPA upload (and nothing else). | ||
# This builder does the Ubuntu PPA and Linux Azure uploads | ||
- os: linux | ||
dist: trusty | ||
go: 1.7 | ||
env: PPA | ||
env: | ||
- ubuntu-ppa | ||
- azure-linux | ||
addons: | ||
apt: | ||
packages: | ||
- gcc-multilib | ||
- devscripts | ||
- debhelper | ||
- dput | ||
script: | ||
- go run build/ci.go debsrc -signer "Felix Lange (Geth CI Testing Key) <[email protected]>" -upload ppa:lp-fjl/geth-ci-testing | ||
- go run build/ci.go install | ||
- go run build/ci.go archive -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds | ||
- go run build/ci.go install -arch 386 | ||
- go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds | ||
|
||
# This builder does the OSX Azure uploads | ||
- os: osx | ||
go: 1.7 | ||
env: | ||
- azure-osx | ||
script: | ||
- go run build/ci.go install | ||
- go run build/ci.go archive -type zip -signer OSX_SIGNING_KEY -upload gethstore/builds | ||
- go run build/ci.go install -arch 386 | ||
- go run build/ci.go archive -arch 386 -type zip -signer OSX_SIGNING_KEY -upload gethstore/builds | ||
|
||
install: | ||
- go get golang.org/x/tools/cmd/cover | ||
script: | ||
- go run build/ci.go install | ||
- go run build/ci.go test -coverage -vet | ||
after_success: | ||
# - go run build/ci.go archive -type tar | ||
|
||
notifications: | ||
webhooks: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This file is part of the go-ethereum library. | ||
// | ||
// The go-ethereum library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The go-ethereum library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package build | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/Azure/azure-sdk-for-go/storage" | ||
) | ||
|
||
// AzureBlobstoreConfig is an authentication and configuration struct containing | ||
// the data needed by the Azure SDK to interact with a speicifc container in the | ||
// blobstore. | ||
type AzureBlobstoreConfig struct { | ||
Account string // Account name to authorize API requests with | ||
Token string // Access token for the above account | ||
Container string // Blob container to upload files into | ||
} | ||
|
||
// AzureBlobstoreUpload uploads a local file to the Azure Blob Storage. Note, this | ||
// method assumes a max file size of 64MB (Azure limitation). Larger files will | ||
// need a multi API call approach implemented. | ||
// | ||
// See: https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx#Anchor_3 | ||
func AzureBlobstoreUpload(path string, name string, config AzureBlobstoreConfig) error { | ||
// Create an authenticated client against the Azure cloud | ||
rawClient, err := storage.NewBasicClient(config.Account, config.Token) | ||
if err != nil { | ||
return err | ||
} | ||
client := rawClient.GetBlobService() | ||
|
||
// Stream the file to upload into the designated blobstore container | ||
in, err := os.Open(path) | ||
if err != nil { | ||
return err | ||
} | ||
defer in.Close() | ||
|
||
info, err := in.Stat() | ||
if err != nil { | ||
return err | ||
} | ||
return client.CreateBlockBlobFromReader(config.Container, name, uint64(info.Size()), in, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This file is part of the go-ethereum library. | ||
// | ||
// The go-ethereum library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The go-ethereum library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
// signFile reads the contents of an input file and signs it (in armored format) | ||
// with the key provided, placing the signature into the output file. | ||
|
||
package build | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"os" | ||
|
||
"golang.org/x/crypto/openpgp" | ||
) | ||
|
||
// PGPSignFile parses a PGP private key from the specified string and creates a | ||
// signature file into the output parameter of the input file. | ||
// | ||
// Note, this method assumes a single key will be container in the pgpkey arg, | ||
// furthermore that it is in armored format. | ||
func PGPSignFile(input string, output string, pgpkey string) error { | ||
// Parse the keyring and make sure we only have a single private key in it | ||
keys, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(pgpkey)) | ||
if err != nil { | ||
return err | ||
} | ||
if len(keys) != 1 { | ||
return fmt.Errorf("key count mismatch: have %d, want %d", len(keys), 1) | ||
} | ||
// Create the input and output streams for signing | ||
in, err := os.Open(input) | ||
if err != nil { | ||
return err | ||
} | ||
defer in.Close() | ||
|
||
out, err := os.Create(output) | ||
if err != nil { | ||
return err | ||
} | ||
defer out.Close() | ||
|
||
// Generate the signature and return | ||
return openpgp.ArmoredDetachSignText(out, keys[0], in, nil) | ||
} |
Oops, something went wrong.