zuul-jobs/roles/trigger-readthedocs/tasks/main.yaml
Ian Wienand 31116ed030 Revert "Debugging for readthedoc web ping"
This reverts commit 5a38208e3b.

Turns out it was a badly encoded password; see
https://review.openstack.org/588182

Change-Id: Ib6c1d3c13340c1cacbc5c6b7e0a77841c0d78afb
2018-08-02 19:18:40 +10:00

43 lines
1.6 KiB
YAML

- name: Check for webhook id
fail:
msg: You must define the webhook id. Get this from the webhook info page on RTD
when: rtd_webhook_id is not defined
- name: Check for an authentication type
fail:
msg: Must set either rtd_credentials.username or rtd_credentials.integration_token
when: (rtd_credentials.username is not defined) and (rtd_credentials.integration_token is not defined)
- when: rtd_credentials.username is defined
block:
- name: Require password
fail:
msg: password is required when using rtd_credentials.username
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
# avoid logging any credentials
no_log: true
- when: rtd_credentials.integration_token is defined and
rtd_credentials.username is not defined
block:
- name: Trigger readthedocs build webhook via token
uri:
method: POST
url: 'https://readthedocs.org/api/v2/webhook/{{ rtd_project_name }}/{{ rtd_webhook_id }}/'
body_format: form-urlencoded
body:
token: '{{ rtd_credentials.integration_token }}'
follow_redirects: all
# avoid logging any credentials
no_log: true