Apply suggestions from code review

fix formatting based on review

Co-Authored-By: Tejal Desai <tejal29@gmail.com>
This commit is contained in:
Tao Yang 2019-10-21 10:19:32 +08:00 committed by GitHub
parent 78e9974694
commit a86ffc8c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -37,18 +37,18 @@ type AzureBlob struct {
// Download context file from given azure blob storage url and unpack it to BuildContextDir
func (b *AzureBlob) UnpackTarFromBuildContext() (string, error) {
//Get Azure_STORAGE_ACCESS_KEY from environment variables
// Get Azure_STORAGE_ACCESS_KEY from environment variables
accountKey := os.Getenv("AZURE_STORAGE_ACCESS_KEY")
if len(accountKey) == 0 {
return "", errors.New("AZURE_STORAGE_ACCESS_KEY environment variable is not set")
}
//Get storage accoutname for Azure Blob Storage
// Get storage accoutname for Azure Blob Storage
u, _ := url.Parse(b.context)
parts := azblob.NewBlobURLParts(*u)
accountName := strings.Split(parts.Host, ".")[0]
//Generate credentail with accountname and accountkey
// Generate credentail with accountname and accountkey
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
return parts.Host, err

View File

@ -80,7 +80,7 @@ const (
// ScratchEnvVars are the default environment variables needed for a scratch image.
var ScratchEnvVars = []string{"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}
//AzureBlobStorageHostRegEx is ReqEX for Valid azure blob storage host suffix in url for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment
// AzureBlobStorageHostRegEx is ReqEX for Valid azure blob storage host suffix in url for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment
var AzureBlobStorageHostRegEx = []string{"https://(.+?).blob.core.windows.net/(.+)",
"https://(.+?).blob.core.chinacloudapi.cn/(.+)",
"https://(.+?).blob.core.cloudapi.de/(.+)",

View File

@ -22,8 +22,8 @@ import (
"github.com/GoogleContainerTools/kaniko/pkg/constants"
)
//Validate if the host url provided is with correct suffix for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment
//RegEX for supported suffix defined in constants.AzureBlobStorageHostRegEx
// Validate if the host url provided is with correct suffix for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment
// RegEX for supported suffix defined in constants.AzureBlobStorageHostRegEx
func ValidAzureBlobStorageHost(context string) bool {
for _, re := range constants.AzureBlobStorageHostRegEx {
validBlobURL := regexp.MustCompile(re)