Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(develop): remove cleanbucket workflow #1094

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/dev_node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

node_12:
if: always()
Expand Down Expand Up @@ -106,7 +105,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

node_14:
if: always()
Expand Down Expand Up @@ -140,35 +138,3 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

cleanAllBucket:
if: always()
needs: [node_10, node_12, node_14]
environment: ali_oss_AK
runs-on: ubuntu-latest

env:
ONCI: true
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_STS_BUCKET: ${{secrets.ALI_SDK_STS_BUCKET}}
ALI_SDK_STS_ID: ${{secrets.ALI_SDK_STS_ID}}
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}

strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: clean all bucket
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: node test/node/cleanAllBucket.js
34 changes: 1 addition & 33 deletions .github/workflows/master_node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Master branch
on:
push:
branches: [master]
pull_request:
pull_request:
branches: [master]

jobs:
Expand Down Expand Up @@ -68,7 +68,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

node_12:
if: always()
Expand Down Expand Up @@ -100,7 +99,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

node_14:
if: always()
Expand Down Expand Up @@ -132,33 +130,3 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

cleanAllBucket:
if: always()
needs: [node_10, node_12, node_14]
environment: ali_oss_AK
runs-on: ubuntu-latest

env:
ONCI: true
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_STS_BUCKET: ${{secrets.ALI_SDK_STS_BUCKET}}
ALI_SDK_STS_ID: ${{secrets.ALI_SDK_STS_ID}}
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}

strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: clean all bucket
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: node test/node/cleanAllBucket.js
15 changes: 11 additions & 4 deletions test/node/cleanAllBucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ const config = require('../config').oss;
const OSS = require('../..');

const store = OSS(config);
const interval = new Date().getTime() - 24 * 60 * 60 * 7 * 1000;

store.listBuckets().then(r => {
const bucketList = [];
r.buckets.forEach(i => {
if (i.name.indexOf('ali-oss') === 0) {
bucketList.push({
bucket: i.name,
region: i.region
});
if (calculateData(i.name) < interval) {
bucketList.push({
bucket: i.name,
region: i.region
});
}
}
});

Expand All @@ -27,3 +30,7 @@ store.listBuckets().then(r => {
});
}
});

const calculateData = bucket => {
return parseInt(bucket.split('-').pop());
};