Skip to content

Commit f47aa48

Browse files
generate logs.json
1 parent 3b84b37 commit f47aa48

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/interop.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ jobs:
1010
permissions:
1111
id-token: write
1212
contents: read
13-
env:
14-
BUCKET: "quic-interop-runner"
15-
RETENTION_DAYS: "3"
1613
steps:
1714
- uses: actions/checkout@v3
1815
- uses: actions/setup-python@v4
@@ -24,10 +21,10 @@ jobs:
2421
env:
2522
B2_APPLICATION_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }}
2623
B2_APPLICATION_KEY: ${{ secrets.BACKBLAZE_APPLICATION_KEY }}
27-
- name: upload a file
24+
- name: remove old logs
2825
run: |
29-
threshold_time=$((($(date +%s) * 1000) - (${{ env.RETENTION_DAYS }} * 24 * 60 * 60 * 1000)))
30-
old_files=$(b2 ls --json ${{ env.BUCKET}} | jq -r ".[] | select(.uploadTimestamp > $threshold_time)")
26+
threshold_time=$((($(date +%s) * 1000) - (${{ env.LOG_RETENTION_DAYS }} * 24 * 60 * 60 * 1000)))
27+
old_files=$(b2 ls --json ${{ env.BACKBLAZE_BUCKET}} | jq -r ".[] | select(.uploadTimestamp < $threshold_time)")
3128
echo "Deleting files:"
3229
echo $old_files | jq ".fileName"
3330
# Now delete them
@@ -36,7 +33,12 @@ jobs:
3633
echo "Deleting $dir_name"
3734
# see https://github.com/Backblaze/B2_Command_Line_Tool/issues/495#issuecomment-413932585
3835
mkdir empty # create an empty directory
39-
b2 sync --delete --allowEmptySource empty b2://${{ env.BUCKET }}/"$dir_name"
36+
b2 sync --delete --allowEmptySource empty b2://${{ env.BACKBLAZE_BUCKET }}/"$dir_name"
4037
rmdir empty
4138
done
39+
- name: generate logs.json and upload it
40+
run: |
41+
b2 ls --json quic-interop-runner | jq '[sort_by(.uploadTimestamp) | .[] | select(.fileName | contains("/")) | .fileName | split("/")[0] | select(. != null)]' > logs.json
42+
b2 sync logs.json b2://${{ env.BACKBLAZE_BUCKET }}
43+
4244

0 commit comments

Comments
 (0)