Skip to content

Commit 8a7ad9d

Browse files
authored
Merge branch 'master' into vpc
2 parents 7e0991f + a91d3ad commit 8a7ad9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1674
-37
lines changed

.github/workflows/go.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
# fetch submodule for aliyun-openapi-meta
16+
- run: git submodule update --init --recursive
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.16
22+
23+
- name: Build
24+
run: make build
25+
26+
- name: Test
27+
run: go vet ./cli/... ./config/... ./i18n/... ./main/... ./openapi/... ./oss/... ./resource/...
28+
- run: go test -race -coverprofile=coverage.txt -covermode=atomic ./cli/... ./config/... ./i18n/... ./meta/... ./main/... ./openapi/... ./resource/...
29+
- run: test -z $ACCESS_KEY_ID -a -z $ACCESS_KEY_SECRET || bash ./integration/ecs_test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ English | [简体中文](./README-CN.md)
33
<h1 align="center">Alibaba Cloud CLI</h1>
44

55
<p align="center">
6-
<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>
6+
<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>
77
<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>
88
<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>
99
<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>

config/legacy.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ func MigrateLegacyConfiguration() (conf *Configuration, err error) {
2727
return
2828
}
2929

30-
conf, err = MigrateCredentials(path)
31-
if err != nil {
30+
conf, migrateErr := MigrateCredentials(path)
31+
if migrateErr != nil {
3232
return
3333
}
3434

3535
path = hookGetHomePath(GetHomePath)() + "/.aliyuncli/configure"
36-
err = MigrateConfigure(path, conf)
36+
mfErr := MigrateConfigure(path, conf)
37+
if mfErr != nil {
38+
return
39+
}
40+
3741
return
3842
}
3943

@@ -97,5 +101,5 @@ func MigrateConfigure(path string, conf *Configuration) (err error) {
97101
}
98102
}
99103

100-
return
104+
return nil
101105
}

config/legacy_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ func TestMigrateConfigure(t *testing.T) {
6262
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"}}}
6363
err := MigrateConfigure("http://nici", conf)
6464
if runtime.GOOS == "windows" {
65-
assert.Equal(t, "parse failed: open http://nici: The filename, directory name, or volume label syntax is incorrect.", err.Error())
65+
assert.Equal(t, "parse failed: open http://nici: The filename, directory name, or volume label syntax is incorrect.\n", err.Error())
6666
} else {
67-
assert.Equal(t, "parse failed: open http://nici: no such file or directory", err.Error())
67+
assert.Equal(t, "parse failed: open http://nici: no such file or directory\n", err.Error())
6868
}
6969

7070
test, err := os.Create("testconf.ini")
@@ -101,11 +101,13 @@ func TestMigrateLegacyConfiguration(t *testing.T) {
101101
os.RemoveAll("./.aliyuncli")
102102
hookGetHomePath = orighookGetHomePath
103103
}()
104+
104105
hookGetHomePath = func(fn func() string) func() string {
105106
return func() string {
106107
return "."
107108
}
108109
}
110+
109111
err := os.Mkdir("./.aliyuncli", os.ModePerm)
110112
assert.Nil(t, err)
111113

@@ -126,5 +128,5 @@ func TestMigrateLegacyConfiguration(t *testing.T) {
126128
test.Close()
127129
conf, err := MigrateLegacyConfiguration()
128130
assert.Nil(t, err)
129-
assert.Nil(t, conf)
131+
assert.NotNil(t, conf)
130132
}

oss/lib/allpart_size.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ var allPartSizeCommand = AllPartSizeCommand{
9595
OptionEncodingType,
9696
OptionLogLevel,
9797
OptionPassword,
98+
OptionMode,
99+
OptionECSRoleName,
100+
OptionTokenTimeout,
101+
OptionRamRoleArn,
102+
OptionRoleSessionName,
103+
OptionReadTimeout,
104+
OptionConnectTimeout,
105+
OptionSTSRegion,
98106
},
99107
},
100108
}

oss/lib/append_file.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ var appendFileCommand = AppendFileCommand{
150150
OptionLogLevel,
151151
OptionRequestPayer,
152152
OptionPassword,
153+
OptionMode,
154+
OptionECSRoleName,
155+
OptionTokenTimeout,
156+
OptionRamRoleArn,
157+
OptionRoleSessionName,
158+
OptionReadTimeout,
159+
OptionConnectTimeout,
160+
OptionSTSRegion,
153161
},
154162
},
155163
}

oss/lib/bucket_cors.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ var corsCommand = CorsCommand{
146146
OptionMethod,
147147
OptionLogLevel,
148148
OptionPassword,
149+
OptionMode,
150+
OptionECSRoleName,
151+
OptionTokenTimeout,
152+
OptionRamRoleArn,
153+
OptionRoleSessionName,
154+
OptionReadTimeout,
155+
OptionConnectTimeout,
156+
OptionSTSRegion,
149157
},
150158
},
151159
}

oss/lib/bucket_encryption.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ var bucketEncryptionCommand = BucketEncryptionCommand{
135135
OptionKMSMasterKeyID,
136136
OptionKMSDataEncryption,
137137
OptionPassword,
138+
OptionMode,
139+
OptionECSRoleName,
140+
OptionTokenTimeout,
141+
OptionRamRoleArn,
142+
OptionRoleSessionName,
143+
OptionReadTimeout,
144+
OptionConnectTimeout,
145+
OptionSTSRegion,
138146
},
139147
},
140148
}

oss/lib/bucket_inventory.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ var bucketInventoryCommand = BucketInventoryCommand{
207207
OptionMethod,
208208
OptionMarker,
209209
OptionPassword,
210+
OptionMode,
211+
OptionECSRoleName,
212+
OptionTokenTimeout,
213+
OptionRamRoleArn,
214+
OptionRoleSessionName,
215+
OptionReadTimeout,
216+
OptionConnectTimeout,
217+
OptionSTSRegion,
210218
},
211219
},
212220
}

oss/lib/bucket_lifecycle.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ var bucketLifeCycleCommand = BucketLifeCycleCommand{
165165
OptionLogLevel,
166166
OptionMethod,
167167
OptionPassword,
168+
OptionMode,
169+
OptionECSRoleName,
170+
OptionTokenTimeout,
171+
OptionRamRoleArn,
172+
OptionRoleSessionName,
173+
OptionReadTimeout,
174+
OptionConnectTimeout,
175+
OptionSTSRegion,
168176
},
169177
},
170178
}

0 commit comments

Comments
 (0)