|
44 | 44 | - apt
|
45 | 45 | - dl
|
46 | 46 | - archive
|
| 47 | + - cache |
47 | 48 | steps:
|
48 | 49 |
|
49 | 50 | - name: "Install dependencies: lftp"
|
|
60 | 61 | cd source ; lftp -e "mirror --include-glob=*/archive/*.torrent --parallel=64; exit" https://rsync.armbian.com/${{ matrix.platform }}
|
61 | 62 | cd ..
|
62 | 63 | find source/*/archive/ -mindepth 1 -maxdepth 1 -exec mv -i -- {} destination/ \;
|
| 64 | + elif [[ "${{ matrix.platform }}" =~ ^(cache) ]]; then |
| 65 | + cd source ; lftp -e "mirror --include-glob=*.torrent --parallel=64; exit" https://rsync.armbian.com/${{ matrix.platform }} |
| 66 | + cd .. |
| 67 | + find source/*/* -mindepth 1 -maxdepth 1 -exec mv -i -- {} destination/ \; |
63 | 68 | else
|
64 | 69 | cd destination; lftp -e "mirror --parallel=64; exit" https://rsync.armbian.com/${{ matrix.platform }}/dists
|
65 | 70 | fi
|
@@ -148,6 +153,25 @@ jobs:
|
148 | 153 | | xargs -n3 -d'\n' | sed -e 's/\s\+/\//' | sed "s/ /,/" | jq -cnR '[inputs | select(length>0)]' | jq >> $GITHUB_OUTPUT
|
149 | 154 | echo 'EOF' >> $GITHUB_OUTPUT
|
150 | 155 |
|
| 156 | + Cache-index: |
| 157 | + name: "Compare cache mirrors" |
| 158 | + needs: build |
| 159 | + outputs: |
| 160 | + matrix: ${{steps.json.outputs.JSON_CONTENT}} |
| 161 | + runs-on: ubuntu-24.04 |
| 162 | + steps: |
| 163 | + |
| 164 | + - name: "Get cache mirrors from database" |
| 165 | + id: json |
| 166 | + run: | |
| 167 | +
|
| 168 | + echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT |
| 169 | + curl -H "Authorization: Token ${{ secrets.NETBOX_TOKEN }}" -H "Accept: application/json; indent=4" \ |
| 170 | + "${{ secrets.NETBOX_API }}/virtualization/virtual-machines/?limit=500&name__empty=false&tag=cache&status=active" \ |
| 171 | + | jq '.results[] | .name,.custom_fields["download_path_images"],.id' | sed "s|null|cache|" | sed "s/\"//g" \ |
| 172 | + | xargs -n3 -d'\n' | sed -e 's/\s\+/\//' | sed "s/ /,/" | jq -cnR '[inputs | select(length>0)]' | jq >> $GITHUB_OUTPUT |
| 173 | + echo 'EOF' >> $GITHUB_OUTPUT |
| 174 | +
|
151 | 175 | Debs-beta:
|
152 | 176 | name: "B"
|
153 | 177 | runs-on: ubuntu-24.04
|
@@ -386,8 +410,68 @@ jobs:
|
386 | 410 | path: status
|
387 | 411 | if-no-files-found: ignore
|
388 | 412 |
|
| 413 | + Cache: |
| 414 | + name: "C" |
| 415 | + runs-on: ubuntu-24.04 |
| 416 | + needs: [ Cache-index ] |
| 417 | + outputs: |
| 418 | + matrix: ${{needs.Cache-index.outputs.matrix}} |
| 419 | + if: ${{ needs.Cache-index.outputs.matrix != '[]' && needs.Cache-index.outputs.matrix != '' }} |
| 420 | + timeout-minutes: 7 |
| 421 | + strategy: |
| 422 | + fail-fast: false |
| 423 | + matrix: |
| 424 | + node: ${{fromJson(needs.Cache-index.outputs.matrix)}} |
| 425 | + |
| 426 | + steps: |
| 427 | + |
| 428 | + - uses: actions/download-artifact@v4 |
| 429 | + with: |
| 430 | + name: cache |
| 431 | + path: cache |
| 432 | + |
| 433 | + - name: "Install dependencies" |
| 434 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 435 | + with: |
| 436 | + packages: lftp |
| 437 | + version: 1.0 |
| 438 | + |
| 439 | + - name: "Check ${{ matrix.node }} " |
| 440 | + run: | |
| 441 | +
|
| 442 | + SERVER_URL=$(echo "${{ matrix.node }}" | cut -d"," -f1) |
| 443 | + SERVER_ID=$(echo "${{ matrix.node }}" | cut -d"," -f2) |
| 444 | + echo "SERVER_ID=${SERVER_ID}" >> $GITHUB_ENV |
| 445 | + mkdir -p compare source; cd source |
| 446 | + if curl --output /dev/null --silent --head --fail "https://${SERVER_URL}"; then |
| 447 | + timeout 5m lftp -e "mirror --include-glob=*.torrent --parallel=64; exit" https://${SERVER_URL} || exit_status=$? |
| 448 | + cd .. |
| 449 | + find source/*/*/ -mindepth 1 -maxdepth 1 -exec mv -i -- {} compare/ \; || true |
| 450 | + fi |
| 451 | + OUT=$(diff -rq compare archive || true) |
| 452 | + mkdir -p status |
| 453 | + if [[ -z "${OUT}" ]]; then |
| 454 | + echo "true" >> status/${SERVER_ID} |
| 455 | + echo "STATUS=true" >> $GITHUB_ENV |
| 456 | + elif [[ "${exit_status}" -eq 0 ]]; then |
| 457 | + echo "not_in_sync" >> status/${SERVER_ID} |
| 458 | + echo "${SERVER_URL}" >> status/${SERVER_ID} |
| 459 | + echo "STATUS=not_in_sync" >> $GITHUB_ENV |
| 460 | + elif [[ "${exit_status}" -eq 124 ]]; then |
| 461 | + echo "timeout" >> status/${SERVER_ID} |
| 462 | + echo "${SERVER_URL}" >> status/${SERVER_ID} |
| 463 | + echo "STATUS=not_in_sync" >> $GITHUB_ENV |
| 464 | + fi |
| 465 | +
|
| 466 | + - name: Upload ${{ env.STATUS }} for ${{ matrix.node }} |
| 467 | + uses: actions/upload-artifact@v4 |
| 468 | + with: |
| 469 | + name: archive-${{ env.SERVER_ID }} |
| 470 | + path: status |
| 471 | + if-no-files-found: ignore |
| 472 | + |
389 | 473 | download:
|
390 |
| - needs: [ Debs-beta,Debs-stable,Images-stable,Images-archive ] |
| 474 | + needs: [ Debs-beta,Debs-stable,Images-stable,Images-archive, Cache ] |
391 | 475 | runs-on: ubuntu-24.04
|
392 | 476 | steps:
|
393 | 477 |
|
@@ -523,6 +607,38 @@ jobs:
|
523 | 607 | reloadKey: ${{ env.reloadKey }}
|
524 | 608 | netbox: ${{ secrets.NETBOX_TOKEN }}
|
525 | 609 |
|
| 610 | + - name: Download All Artifacts |
| 611 | + uses: actions/download-artifact@v4 |
| 612 | + with: |
| 613 | + path: status |
| 614 | + pattern: cache* |
| 615 | + merge-multiple: true |
| 616 | + |
| 617 | + - name: "Grep only those that are in sync" |
| 618 | + run: | |
| 619 | + echo "# Not in sync" >> $GITHUB_STEP_SUMMARY |
| 620 | + #echo "$(grep not_in_sync status/* | cut -d":" -f1 | cut -d"/" -f2 | sed ':a; N; s/\n/ /; ta') " >> $GITHUB_STEP_SUMMARY |
| 621 | + grep not_in_sync status/* | cut -d":" -f1 | xargs awk 'FNR==2{print}' >> $GITHUB_STEP_SUMMARY |
| 622 | + echo "# Timeouts" >> $GITHUB_STEP_SUMMARY |
| 623 | + grep timeout status/* | cut -d":" -f1 | xargs awk 'FNR==2{print}' >> $GITHUB_STEP_SUMMARY |
| 624 | + #echo "$(grep timeout status/* | cut -d":" -f1 | cut -d"/" -f2 | sed ':a; N; s/\n/ /; ta') " >> $GITHUB_STEP_SUMMARY |
| 625 | +
|
| 626 | + echo "failoverserver=$(grep true status/* | cut -d":" -f1 | cut -d"/" -f2 | sed ':a; N; s/\n/ /; ta') " >> $GITHUB_ENV |
| 627 | + echo "reloadKey=$(openssl rand -hex 16)" >> $GITHUB_ENV |
| 628 | + rm -rf status |
| 629 | +
|
| 630 | + - name: Cache |
| 631 | + uses: armbian/actions/make-yaml-redirector@main |
| 632 | + with: |
| 633 | + variant: cache |
| 634 | + failoverserver: "${{ env.failoverserver }}" |
| 635 | + port: 8084 |
| 636 | + geodb: "${{ env.GEODB }}" |
| 637 | + asndb: "${{ env.ASNDB }}" |
| 638 | + dl_map: "${{ env.DL_MAP }}" |
| 639 | + reloadKey: ${{ env.reloadKey }} |
| 640 | + netbox: ${{ secrets.NETBOX_TOKEN }} |
| 641 | + |
526 | 642 | Close:
|
527 | 643 | needs: [ download ]
|
528 | 644 | runs-on: ubuntu-24.04
|
@@ -578,6 +694,7 @@ jobs:
|
578 | 694 | beta
|
579 | 695 | dl
|
580 | 696 | archive
|
| 697 | + cache |
581 | 698 |
|
582 | 699 | - name: "Run webindex update action"
|
583 | 700 | uses: peter-evans/repository-dispatch@v3
|
|
0 commit comments