Commit Graph

6 Commits

Author SHA1 Message Date
Ian Wienand 6d23d20f2f linters: add names to blocks
This is preparation for a later version of ansbile-lint, which finds
missing names on blocks.  This seems a reasonable rule, and the
Ansible manual says [1]

  Names for blocks have been available since Ansible 2.3. We recommend
  using names in all tasks, within blocks or elsewhere, for better
  visibility into the tasks being executed when you run the playbook.

This simply adds a name tag for blocks that are missing it.  This
should have no operational change, but allows us to update the linter
in a follow-on change.

[1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html

Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
2022-07-27 17:13:39 +10:00
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
Ian Wienand 5a38208e3b Debugging for readthedoc web ping
Unfortunately this is failing in the gate, and I have no idea why (it
works locally ...).  Add some debugging.  Since this is called with a
secret from a post-review only job in the trusted project-config repo,
there's little way to self-test this without committing things :/
Hopefully this sheds some light ...

Change-Id: I7d661f8eefe25d90b5eded309062f32344b3379c
2018-08-02 16:25:00 +10:00
Ian Wienand 8fc3461f59 trigger-readthedocs: fix typo
This was just a variable change I missed in
I514fb1285196aae0b49a98f0efc21326730e4179 ; the name of the variable
doesn't need the "rtd_" prefix.

Change-Id: I3774b370920be816235ee3af804f6de92d3ba0f5
2018-08-02 14:51:11 +10:00
Ian Wienand bd4e5a54d7 trigger-readthedocs: Move secret bits into a dict
What I missed when I layed this out was that you setup a secret like

 - secret:
   name: rtd_credentials
   data:
     username: openstackci
     password: foo

what you have in the job variables is a dictionary called
"rtd_credentials".

It makes it much simpler to use the role with the secret if it accepts
this variable, rather than having to extract the username/password etc
out of the secret dictionary into separate variables.

Additionally, turn on no_log for the uri calls, to avoid potentially
logging any credentials.

Change-Id: I514fb1285196aae0b49a98f0efc21326730e4179
2018-08-02 07:49:24 +10:00
Ian Wienand 70fef1a858 Add role to trigger readthedocs via authenticated endpoint
The old API endpoint is deprecated, so add a role that pings the
webhook as described in [1].

Authentication can happen via a token or username/password combo,
which need to be kept in secrets.

The webhook api has an "id" value which some fiddling suggests is an
incrementing integer each time a webhook endpoint is generated (if you
create, delete, create your webhook via the admin interface, you often
as not get the next value).  Unfortunately, it appears you can not
query this in any way automatically; it has to be provided.  However,
I do not believe this has to be secret; you can not trigger the
end-point without authentication (either password or token).

This means the generic playbook here will not work any more.  Because
secrets are bound to the playbook they are defined within, this role
will need to be called directly.  It will be removed in a follow-on.

[1] https://docs.readthedocs.io/en/latest/webhooks.html

Change-Id: I651efdb093df85cea3ab2eaf1a5a9256c87a2ca4
2018-07-19 12:27:51 +10:00