Skip to content

Commit

Permalink
Merge branch 'master' into vpc
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian authored Jul 2, 2021
2 parents 7e0991f + a91d3ad commit 8a7ad9d
Show file tree
Hide file tree
Showing 56 changed files with 1,674 additions and 37 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Go

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# fetch submodule for aliyun-openapi-meta
- run: git submodule update --init --recursive

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Build
run: make build

- name: Test
run: go vet ./cli/... ./config/... ./i18n/... ./main/... ./openapi/... ./oss/... ./resource/...
- run: go test -race -coverprofile=coverage.txt -covermode=atomic ./cli/... ./config/... ./i18n/... ./meta/... ./main/... ./openapi/... ./resource/...
- run: test -z $ACCESS_KEY_ID -a -z $ACCESS_KEY_SECRET || bash ./integration/ecs_test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ English | [简体中文](./README-CN.md)
<h1 align="center">Alibaba Cloud CLI</h1>

<p align="center">
<a href="https://travis-ci.com/aliyun/aliyun-cli"><img src="https://travis-ci.com/aliyun/aliyun-cli.svg?branch=master" alt="Travis Build Status"></a>
<a href="https://github.com/aliyun/aliyun-cli/actions/workflows/go.yml"><img src="https://github.com/aliyun/aliyun-cli/actions/workflows/go.yml/badge.svg" alt="Go build Status"></a>
<a href="https://ci.appveyor.com/project/aliyun/aliyun-cli"><img src="https://ci.appveyor.com/api/projects/status/avxoqqcmgksbt3d8/branch/master?svg=true" alt="Appveyor Build Status"></a>
<a href="https://codecov.io/gh/aliyun/aliyun-cli"><img src="https://codecov.io/gh/aliyun/aliyun-cli/branch/master/graph/badge.svg" alt="codecov"></a>
<a href="https://github.com/aliyun/aliyun-cli/blob/master/LICENSE"><img src="https://img.shields.io/github/license/aliyun/aliyun-cli.svg" alt="License"></a>
Expand Down
12 changes: 8 additions & 4 deletions config/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ func MigrateLegacyConfiguration() (conf *Configuration, err error) {
return
}

conf, err = MigrateCredentials(path)
if err != nil {
conf, migrateErr := MigrateCredentials(path)
if migrateErr != nil {
return
}

path = hookGetHomePath(GetHomePath)() + "/.aliyuncli/configure"
err = MigrateConfigure(path, conf)
mfErr := MigrateConfigure(path, conf)
if mfErr != nil {
return
}

return
}

Expand Down Expand Up @@ -97,5 +101,5 @@ func MigrateConfigure(path string, conf *Configuration) (err error) {
}
}

return
return nil
}
8 changes: 5 additions & 3 deletions config/legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func TestMigrateConfigure(t *testing.T) {
conf := &Configuration{CurrentProfile: "default", Profiles: []Profile{Profile{Name: "default", Mode: AK, AccessKeyId: "default_aliyun_access_key_id", AccessKeySecret: "default_aliyun_access_key_secret", OutputFormat: "json"}, Profile{Name: "aaa", Mode: AK, AccessKeyId: "sdf", AccessKeySecret: "ddf", OutputFormat: "json"}}}
err := MigrateConfigure("http://nici", conf)
if runtime.GOOS == "windows" {
assert.Equal(t, "parse failed: open http://nici: The filename, directory name, or volume label syntax is incorrect.", err.Error())
assert.Equal(t, "parse failed: open http://nici: The filename, directory name, or volume label syntax is incorrect.\n", err.Error())
} else {
assert.Equal(t, "parse failed: open http://nici: no such file or directory", err.Error())
assert.Equal(t, "parse failed: open http://nici: no such file or directory\n", err.Error())
}

test, err := os.Create("testconf.ini")
Expand Down Expand Up @@ -101,11 +101,13 @@ func TestMigrateLegacyConfiguration(t *testing.T) {
os.RemoveAll("./.aliyuncli")
hookGetHomePath = orighookGetHomePath
}()

hookGetHomePath = func(fn func() string) func() string {
return func() string {
return "."
}
}

err := os.Mkdir("./.aliyuncli", os.ModePerm)
assert.Nil(t, err)

Expand All @@ -126,5 +128,5 @@ func TestMigrateLegacyConfiguration(t *testing.T) {
test.Close()
conf, err := MigrateLegacyConfiguration()
assert.Nil(t, err)
assert.Nil(t, conf)
assert.NotNil(t, conf)
}
8 changes: 8 additions & 0 deletions oss/lib/allpart_size.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ var allPartSizeCommand = AllPartSizeCommand{
OptionEncodingType,
OptionLogLevel,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/append_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ var appendFileCommand = AppendFileCommand{
OptionLogLevel,
OptionRequestPayer,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ var corsCommand = CorsCommand{
OptionMethod,
OptionLogLevel,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ var bucketEncryptionCommand = BucketEncryptionCommand{
OptionKMSMasterKeyID,
OptionKMSDataEncryption,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ var bucketInventoryCommand = BucketInventoryCommand{
OptionMethod,
OptionMarker,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ var bucketLifeCycleCommand = BucketLifeCycleCommand{
OptionLogLevel,
OptionMethod,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ var bucketLogCommand = BucketLogCommand{
OptionMethod,
OptionLogLevel,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ var bucketPolicyCommand = BucketPolicyCommand{
OptionLogLevel,
OptionMethod,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_qos.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ var bucketQosCommand = BucketQosCommand{
OptionLogLevel,
OptionMethod,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_referer.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ var bucketRefererCommand = BucketRefererCommand{
OptionDisableEmptyReferer,
OptionMethod,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_tagging.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ var bucketTagCommand = BucketTagCommand{
OptionMethod,
OptionLogLevel,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_versioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ var bucketVersioningCommand = BucketVersioningCommand{
OptionMethod,
OptionLogLevel,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_website.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ var bucketWebsiteCommand = BucketWebSiteCommand{
OptionLogLevel,
OptionMethod,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/bucket_worm.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ var wormCommand = WormCommand{
OptionProxyPwd,
OptionLogLevel,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions oss/lib/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ var catCommand = CatCommand{
OptionVersionId,
OptionRequestPayer,
OptionPassword,
OptionMode,
OptionECSRoleName,
OptionTokenTimeout,
OptionRamRoleArn,
OptionRoleSessionName,
OptionReadTimeout,
OptionConnectTimeout,
OptionSTSRegion,
},
},
}
Expand Down
Loading

0 comments on commit 8a7ad9d

Please sign in to comment.