TUN-9800: Fix docker hub push step

This commit is contained in:
João "Pisco" Fernandes 2025-11-07 11:13:47 +00:00
parent 29e8d936f2
commit 9ce16c5aac
2 changed files with 21 additions and 9 deletions

View File

@ -16,8 +16,13 @@ include:
- release-cloudflared-to-r2 - release-cloudflared-to-r2
commentImageRefs: false commentImageRefs: false
runner: vm-linux-x86-4cpu-8gb runner: vm-linux-x86-4cpu-8gb
DOCKER_USER_BRANCH: svcgithubdockerhubcloudflar045 # Based on if the CI reference is protected or not the CI component will
DOCKER_PASSWORD_BRANCH: gitlab/cloudflare/tun/cloudflared/_dev/dockerhub/svc_password/data # 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 EXTRA_DIB_ARGS: --overwrite
.default-release-job: &release-job-defaults .default-release-job: &release-job-defaults

View File

@ -33,13 +33,20 @@ class TestTunnel:
LOGGER.debug(config) LOGGER.debug(config)
with start_cloudflared(tmp_path, config, cfd_pre_args=["tunnel", "--ha-connections", "1"], cfd_args=["run"], new_process=True): 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) wait_tunnel_ready(require_min_connections=1)
resp = send_request(config.get_url()+"/") expected_status_code = 503
assert resp.status_code == 503, "Expected cloudflared to return 503 for all requests with no ingress defined" resp = send_request(config.get_url()+"/", expected_status_code)
resp = send_request(config.get_url()+"/test") assert resp.status_code == expected_status_code, "Expected cloudflared to return 503 for all requests with no ingress defined"
assert resp.status_code == 503, "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) @retry(retry_on_result=retry_if_result_none, stop_max_attempt_number=MAX_RETRIES, wait_fixed=BACKOFF_SECS * 1000)
def send_request(url, headers={}): def send_request(url, expected_status_code=200):
with requests.Session() as s: 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