-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: to #50200336 合并修复uploadPart无法传递headers参数的问题 (#1214)
* fix: to #50200336 修复uploadPart无法传递headers参数的问 题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题并优化添加测试用例 * fix: to #50200336 修复uploadPart无法传递headers参数的问题并优化添加测试用例 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问 题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 * fix: to #50200336 修复uploadPart无法传递headers参数的问题 --------- Co-authored-by: 陈顺刚 <csg01123119@alibaba-inc.com>
- Loading branch information
Showing
15 changed files
with
64 additions
and
79 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# 每天0点定时清理测试的bucket | ||
name: 'Schdule Delete' | ||
|
||
on: | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# 漏洞扫描 # | ||
name: SNYK_SCAN | ||
on: | ||
push: | ||
|
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
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
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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
const { env } = process; | ||
|
||
const config = module.exports; | ||
const USWEST = 'oss-us-west-1'; // ONCI 用美国硅谷的region速度会快些 | ||
|
||
config.oss = { | ||
accessKeyId: env.ALI_SDK_OSS_ID, | ||
accessKeySecret: env.ALI_SDK_OSS_SECRET, | ||
accountId: env.ALI_SDK_STS_ROLE.match(/^acs:ram::(\d+):role/i)[1], // 通过roleRan获取主账号id | ||
region: env.ALI_SDK_OSS_REGION || 'oss-cn-hangzhou', | ||
endpoint: env.ONCI ? 'https://oss-us-west-1.aliyuncs.com' : null | ||
endpoint: env.ONCI ? `https://${USWEST}.aliyuncs.com` : undefined | ||
}; | ||
|
||
config.sts = { | ||
accessKeyId: env.ALI_SDK_STS_ID, | ||
accessKeySecret: env.ALI_SDK_STS_SECRET, | ||
roleArn: env.ALI_SDK_STS_ROLE, | ||
bucket: env.ALI_SDK_STS_BUCKET, | ||
endpoint: env.ONCI ? 'https://sts.aliyuncs.com/' : null | ||
endpoint: env.ONCI ? 'https://sts.aliyuncs.com/' : undefined | ||
}; | ||
|
||
config.metaSyncTime = env.ONCI ? '30s' : '1000ms'; | ||
config.timeout = '120s'; | ||
|
||
console.log('--99-', config.oss.accountId); |
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
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
/* eslint-disable no-console */ | ||
const utils = require('./utils'); | ||
const config = require('../config').oss; | ||
const OSS = require('../..'); | ||
|
||
const store = new OSS(config); | ||
const interval = new Date().getTime() - 24 * 60 * 60 * 1 * 1000; | ||
// const interval = new Date().getTime() - 24 * 60 * 60 * 1 * 1000; | ||
// const calculateData = bucket => { | ||
// return parseInt(bucket.split('-').pop()); | ||
// }; | ||
|
||
store.listBuckets().then(r => { | ||
const bucketList = []; | ||
r.buckets.forEach(i => { | ||
if (i.name.indexOf('ali-oss') === 0) { | ||
if (calculateData(i.name) < interval) { | ||
bucketList.push({ | ||
bucket: i.name, | ||
region: i.region | ||
}); | ||
} | ||
if (i.name.indexOf('ali-oss-') === 0) { | ||
bucketList.push({ | ||
bucket: i.name, | ||
region: i.region | ||
}); | ||
} | ||
}); | ||
|
||
for (const bucketListItem of bucketList) { | ||
console.log(`正在清理:${bucketListItem.bucket}`); | ||
store.options.endpoint.parse(`https://${bucketListItem.region}.aliyuncs.com`); | ||
const client = new OSS({ | ||
...store.options, | ||
bucket: bucketListItem.bucket, | ||
region: bucketListItem.region | ||
region: bucketListItem.region, | ||
}); | ||
utils.cleanBucket(client, bucketListItem.bucket).catch(e => { | ||
console.log('bucket name =======>', bucketListItem.bucket); | ||
console.log('error:====>', e); | ||
}); | ||
} | ||
}); | ||
|
||
const calculateData = bucket => { | ||
return parseInt(bucket.split('-').pop()); | ||
}; |
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
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