From 9ce16c5aac119dee542ff512ac35095b1a31d160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20=22Pisco=22=20Fernandes?= Date: Fri, 7 Nov 2025 11:13:47 +0000 Subject: [PATCH] TUN-9800: Fix docker hub push step --- .ci/release.gitlab-ci.yml | 9 +++++++-- component-tests/test_tunnel.py | 21 ++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.ci/release.gitlab-ci.yml b/.ci/release.gitlab-ci.yml index ab417812..644e20a2 100644 --- a/.ci/release.gitlab-ci.yml +++ b/.ci/release.gitlab-ci.yml @@ -16,8 +16,13 @@ include: - release-cloudflared-to-r2 commentImageRefs: false runner: vm-linux-x86-4cpu-8gb - DOCKER_USER_BRANCH: svcgithubdockerhubcloudflar045 - DOCKER_PASSWORD_BRANCH: gitlab/cloudflare/tun/cloudflared/_dev/dockerhub/svc_password/data + # Based on if the CI reference is protected or not the CI component will + # either use _BRANCH or _PROD, therefore, to prevent the pipelines from failing + # we simply set both to the same value. + DOCKER_USER_BRANCH: &docker-hub-user svcgithubdockerhubcloudflar045 + DOCKER_PASSWORD_BRANCH: &docker-hub-password gitlab/cloudflare/tun/cloudflared/_dev/dockerhub/svc_password/data + DOCKER_USER_PROD: *docker-hub-user + DOCKER_PASSWORD_PROD: *docker-hub-password EXTRA_DIB_ARGS: --overwrite .default-release-job: &release-job-defaults diff --git a/component-tests/test_tunnel.py b/component-tests/test_tunnel.py index 93a39c51..05b46dc0 100644 --- a/component-tests/test_tunnel.py +++ b/component-tests/test_tunnel.py @@ -33,13 +33,20 @@ class TestTunnel: LOGGER.debug(config) with start_cloudflared(tmp_path, config, cfd_pre_args=["tunnel", "--ha-connections", "1"], cfd_args=["run"], new_process=True): wait_tunnel_ready(require_min_connections=1) - resp = send_request(config.get_url()+"/") - assert resp.status_code == 503, "Expected cloudflared to return 503 for all requests with no ingress defined" - resp = send_request(config.get_url()+"/test") - assert resp.status_code == 503, "Expected cloudflared to return 503 for all requests with no ingress defined" + expected_status_code = 503 + resp = send_request(config.get_url()+"/", expected_status_code) + assert resp.status_code == expected_status_code, "Expected cloudflared to return 503 for all requests with no ingress defined" + resp = send_request(config.get_url()+"/test", expected_status_code) + assert resp.status_code == expected_status_code, "Expected cloudflared to return 503 for all requests with no ingress defined" +def retry_if_result_none(result): + ''' + Returns True if the result is None, indicating that the function should be retried. + ''' + return result is None -@retry(stop_max_attempt_number=MAX_RETRIES, wait_fixed=BACKOFF_SECS * 1000) -def send_request(url, headers={}): +@retry(retry_on_result=retry_if_result_none, stop_max_attempt_number=MAX_RETRIES, wait_fixed=BACKOFF_SECS * 1000) +def send_request(url, expected_status_code=200): with requests.Session() as s: - return s.get(url, timeout=BACKOFF_SECS, headers=headers) + resp = s.get(url, timeout=BACKOFF_SECS) + return resp if resp.status_code == expected_status_code else None