forked from org1/infra
fix(connectivity_tester): publish to admin registry (#42)
Publishes the connectivity_tester image to the admin repository registry where the workflow runs. Tracking: admin/ansible#16 Reviewed-on: admin/ansible#42 Co-authored-by: Alex Rudenk <rudolfss13+hermes@gmail.com>
This commit is contained in:
@@ -21,22 +21,31 @@ jobs:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: log into Gitea Packages
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.rudolf.keenetic.link
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: resolve version
|
||||
id: version
|
||||
- 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
|
||||
echo "VERSION=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
|
||||
version="${{ inputs.tag }}"
|
||||
else
|
||||
echo "VERSION=${GITHUB_REF_NAME##*/}" >> "$GITHUB_OUTPUT"
|
||||
version="${GITHUB_REF_NAME##*/}"
|
||||
fi
|
||||
echo "VERSION=$VERSION"
|
||||
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
|
||||
|
||||
- name: setup buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: build and push
|
||||
uses: docker/build-push-action@v6
|
||||
@@ -44,6 +53,8 @@ jobs:
|
||||
context: connectivity_tester
|
||||
file: connectivity_tester/Dockerfile
|
||||
push: true
|
||||
platforms: linux/arm64,linux/arm/v7
|
||||
provenance: false
|
||||
tags: |
|
||||
gitea.rudolf.keenetic.link/hermes/connectivity_tester:${{ steps.version.outputs.VERSION }}
|
||||
gitea.rudolf.keenetic.link/hermes/connectivity_tester:latest
|
||||
${{ steps.metadata.outputs.image }}
|
||||
${{ steps.metadata.outputs.registry }}/${{ steps.metadata.outputs.owner }}/connectivity_tester:latest
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM python:3.12-slim
|
||||
FROM python:3.12-alpine
|
||||
|
||||
WORKDIR /app
|
||||
COPY . /app/
|
||||
|
||||
@@ -247,21 +247,23 @@ async def main() -> int:
|
||||
]
|
||||
LOG.info("--- round begin, attaching to %s (%d endpoints) ---",
|
||||
net_name, len(eps_in_map))
|
||||
_attach(client, self_container, net)
|
||||
attached = _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:
|
||||
_detach(client, self_container, net)
|
||||
if attached:
|
||||
_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:
|
||||
|
||||
@@ -73,9 +73,7 @@ NETWORK_MAP: Dict[str, List[Endpoint]] = {
|
||||
"docker_socket_proxy_hermes_proxy": [
|
||||
Endpoint("hermes-gateway", 8000),
|
||||
],
|
||||
"connectivity_tester_default": [
|
||||
Endpoint("connectivity-tester", 8765),
|
||||
],
|
||||
"connectivity_tester_default": [],
|
||||
"brencher_brencher-net": [
|
||||
Endpoint("brencher-backend", 5000),
|
||||
],
|
||||
|
||||
@@ -3,7 +3,7 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: gitea.rudolf.keenetic.link/hermes/connectivity_tester:${version}
|
||||
image: gitea.rudolf.keenetic.link/${registry_owner}/connectivity_tester:${version}
|
||||
hostname: connectivity-tester
|
||||
user: "0:0"
|
||||
volumes:
|
||||
|
||||
Reference in New Issue
Block a user