From 74c3b435e8ff53c0195ad8b79d94c116fc517baf Mon Sep 17 00:00:00 2001 From: Alex Rudenk Date: Tue, 29 Sep 2026 23:15:21 +0200 Subject: [PATCH] feat(connectivity): deploy tester on all swarm nodes (#48) ## Summary Add the connectivity_tester deployment from the Hermes release branch to admin/master. ## Changes - add the connectivity_tester stack and Brencher integration - dispatch the multi-arch image build to Gitea Actions - publish the image to the admin registry - deploy with registry authentication forwarded to Swarm nodes ## Verification - Actions build completed successfully - Swarm runtime verified on odroid, xu4, and rudolf-T - 3/3 tasks running Source branch: `hermes/ansible@release/0.1.0-connectivity` --------- Co-authored-by: hermes Co-authored-by: brencher_bot Reviewed-on: https://gitea.rudolf.keenetic.link/admin/ansible/pulls/48 Co-authored-by: Alex Rudenk --- .gitea/workflows/release.yml | 39 +++++++-------------------- connectivity_tester/app.py | 16 +++++------ connectivity_tester/network_map.py | 4 ++- connectivity_tester/stack-compose.yml | 3 --- 4 files changed, 19 insertions(+), 43 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 0213a46..5743b26 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -2,16 +2,12 @@ name: release on: push: - branches: - - 'auto-*' tags: - 'v*' workflow_dispatch: inputs: tag: - description: 'Image tag (e.g. auto-)' - required: false - default: latest + required: true type: string jobs: @@ -21,28 +17,12 @@ jobs: - name: checkout uses: actions/checkout@v4 - - name: resolve metadata - id: metadata - run: | - registry="${GITHUB_SERVER_URL#https://}" - registry="${registry#http://}" - owner="${GITHUB_REPOSITORY%%/*}" - if [ -n "${{ inputs.tag }}" ] && [ "${{ inputs.tag }}" != "latest" ]; then - version="${{ inputs.tag }}" - else - version="${GITHUB_REF_NAME##*/}" - fi - echo "registry=${registry}" >> "$GITHUB_OUTPUT" - echo "owner=${owner}" >> "$GITHUB_OUTPUT" - echo "version=${version}" >> "$GITHUB_OUTPUT" - echo "image=${registry}/${owner}/connectivity_tester:${version}" >> "$GITHUB_OUTPUT" - - name: log into Gitea Packages - env: - REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} - REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} - run: | - printf '%s' "$REGISTRY_TOKEN" | docker login "${{ steps.metadata.outputs.registry }}" --username "$REGISTRY_USERNAME" --password-stdin + uses: docker/login-action@v3 + with: + registry: gitea.rudolf.keenetic.link + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} - name: setup buildx uses: docker/setup-buildx-action@v3 @@ -53,8 +33,7 @@ jobs: context: connectivity_tester file: connectivity_tester/Dockerfile push: true - platforms: linux/arm64,linux/arm/v7 - provenance: false + platforms: linux/amd64,linux/arm64,linux/arm/v7 tags: | - ${{ steps.metadata.outputs.image }} - ${{ steps.metadata.outputs.registry }}/${{ steps.metadata.outputs.owner }}/connectivity_tester:latest + gitea.rudolf.keenetic.link/admin/connectivity_tester:${{ inputs.tag || github.ref_name }} + gitea.rudolf.keenetic.link/admin/connectivity_tester:latest diff --git a/connectivity_tester/app.py b/connectivity_tester/app.py index 74fc15d..e34c6e3 100644 --- a/connectivity_tester/app.py +++ b/connectivity_tester/app.py @@ -247,23 +247,21 @@ async def main() -> int: ] LOG.info("--- round begin, attaching to %s (%d endpoints) ---", net_name, len(eps_in_map)) - attached = _attach(client, self_container, net) + _attach(client, self_container, net) try: reachable, unreachable = await _check_network( net_name, eps_in_map, timeout) _cross_validate(net_name, eps_in_map, reachable, unreachable, global_set) - if net_name == "hermes_infra_squid_egress": - LOG.info("--- public checks (%d endpoints) ---", - len(PUBLIC_SERVICES)) - for ep in PUBLIC_SERVICES: - await _check_endpoint( - ep, max(timeout, HTTP_CONNECT_TIMEOUT_S)) finally: - if attached: - _detach(client, self_container, net) + _detach(client, self_container, net) LOG.info("--- round end on %s ---", net_name) + LOG.info("--- public checks (%d endpoints) ---", + len(PUBLIC_SERVICES)) + for ep in PUBLIC_SERVICES: + await _check_endpoint(ep, max(timeout, HTTP_CONNECT_TIMEOUT_S)) + LOG.info("--- negative checks (%d endpoints) ---", len(NEGATIVE)) await _check_negative(NEGATIVE, timeout) except Exception: diff --git a/connectivity_tester/network_map.py b/connectivity_tester/network_map.py index ee7c5ee..fe57539 100644 --- a/connectivity_tester/network_map.py +++ b/connectivity_tester/network_map.py @@ -73,7 +73,9 @@ NETWORK_MAP: Dict[str, List[Endpoint]] = { "docker_socket_proxy_hermes_proxy": [ Endpoint("hermes-gateway", 8000), ], - "connectivity_tester_default": [], + "connectivity_tester_default": [ + Endpoint("connectivity-tester", 8765), + ], "brencher_brencher-net": [ Endpoint("brencher-backend", 5000), ], diff --git a/connectivity_tester/stack-compose.yml b/connectivity_tester/stack-compose.yml index d88d73a..27c3e7d 100644 --- a/connectivity_tester/stack-compose.yml +++ b/connectivity_tester/stack-compose.yml @@ -1,8 +1,5 @@ services: connectivity-tester: - build: - context: . - dockerfile: Dockerfile image: gitea.rudolf.keenetic.link/${registry_owner}/connectivity_tester:${version} hostname: connectivity-tester user: "0:0"