From f2bc6bb699f534092bbb2cfeff27920454790225 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 6 Nov 2024 14:39:46 +0100 Subject: [PATCH] Use "curl" to trigger rtd.org webhook with http basic auth For some reason (unknown really for us) triggering webhook with http basic auth using Ansible's uri module started recently failing when it is run on some operating systems, like e.g. Ubuntu Noble. Let's switch to use curl command directly to trigger that webhook instead. Change-Id: Idbf643ea27220504ac9e37eaf9f18930d2fc08ab --- roles/trigger-readthedocs/tasks/main.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/roles/trigger-readthedocs/tasks/main.yaml b/roles/trigger-readthedocs/tasks/main.yaml index f166da7dc..9a720832b 100644 --- a/roles/trigger-readthedocs/tasks/main.yaml +++ b/roles/trigger-readthedocs/tasks/main.yaml @@ -17,14 +17,15 @@ when: rtd_credentials.password is not defined - name: Trigger readthedocs build webhook via authentication - uri: - method: POST - url: 'https://readthedocs.org/api/v2/webhook/{{ rtd_project_name }}/{{ rtd_webhook_id }}/' - user: '{{ rtd_credentials.username }}' - password: '{{ rtd_credentials.password }}' - # NOTE(ianw): testing it seems the API doesn't respond with - # 401 so this is required - force_basic_auth: yes + # NOTE(ianw): 2024-11-08 the URI module fails here in mysterious + # -- seeminly platform dependent -- ways; see + # https://github.com/readthedocs/readthedocs.org/issues/11753 + # We call curl directly to work around this + ansible.builtin.command: >- + curl + -X POST + -u {{ rtd_credentials.username }}:{{ rtd_credentials.password }} + 'https://readthedocs.org/api/v2/webhook/{{ rtd_project_name }}/{{ rtd_webhook_id }}/' # avoid logging any credentials no_log: true