-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7583913
commit 04fcb2e
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,16 @@ jobs: | |
path: | | ||
${{ matrix.server }}_${{ matrix.client }}_results.json | ||
${{ matrix.server }}_${{ matrix.client }}_measurements.json | ||
- name: Install b2 cli | ||
if: ${{ github.event_name == 'schedule' }} | ||
uses: sylwit/[email protected] | ||
env: | ||
B2_APPLICATION_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }} | ||
B2_APPLICATION_KEY: ${{ secrets.BACKBLAZE_APPLICATION_KEY }} | ||
- name: Upload logs | ||
if: ${{ github.event_name == 'schedule' }} | ||
run: | | ||
b2 sync logs/${{ matrix.server }}_${{ matrix.client }} b2://${{ vars.BACKBLAZE_BUCKET }}/${{ needs.config.outputs.logname }} | ||
aggregate: | ||
needs: [ config, tests ] | ||
runs-on: ubuntu-latest | ||
|
@@ -291,3 +301,36 @@ jobs: | |
jq '. += [ "${{ needs.config.outputs.logname }}" ]' logs.json | sponge logs.json | ||
rm latest || true | ||
ln -s $LOGNAME latest | ||
- name: Install b2 cli | ||
if: ${{ github.event_name == 'schedule' }} | ||
uses: sylwit/[email protected] | ||
env: | ||
B2_APPLICATION_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }} | ||
B2_APPLICATION_KEY: ${{ secrets.BACKBLAZE_APPLICATION_KEY }} | ||
- name: Upload result | ||
if: ${{ github.event_name == 'schedule' }} | ||
run: | | ||
b2 upload-file ./result.json b2://${{ vars.BACKBLAZE_BUCKET }}/${{ needs.config.outputs.logname }}/ | ||
- name: Remove old logs | ||
if: ${{ github.event_name == 'schedule' }} | ||
run: | | ||
# b2 ls neither lists the contents of the bucket, nor does it list all files | ||
# Instead, it returns exactly *one* (the oldest) file per folder | ||
threshold_time=$((($(date +%s) * 1000) - (${{ vars.LOG_RETENTION_DAYS }} * 24 * 60 * 60 * 1000))) | ||
# Now delete them | ||
b2 ls --json ${{ vars.BACKBLAZE_BUCKET}} | jq -r ".[] | select(.uploadTimestamp < $threshold_time) | .fileName" | while read -r filename; do | ||
dir_name="${filename%%/*}" | ||
# skip files, we only care about directories | ||
if [[ "$dir_name" != "." ]]; then | ||
echo "Deleting $dir_name" | ||
# see https://github.com/Backblaze/B2_Command_Line_Tool/issues/495#issuecomment-413932585 | ||
mkdir empty # create an empty directory | ||
b2 sync --delete --allowEmptySource empty b2://${{ vars.BACKBLAZE_BUCKET }}/"$dir_name" | ||
rmdir empty | ||
fi | ||
done | ||
- name: Generate logs.json and upload it | ||
if: ${{ github.event_name == 'schedule' }} | ||
run: | | ||
b2 ls --json quic-interop-runner | jq '[sort_by(.uploadTimestamp) | .[] | select(.fileName | contains("/")) | .fileName | split("/")[0] | select(. != null)]' > logs.json | ||
b2 upload-file ${{ vars.BACKBLAZE_BUCKET }} logs.json logs.json |