ansible/galaxy

Support any CI-server for notifications.

Opened this issue · 4 comments

From @lifeofguenter on June 19, 2017 11:50

The notification/webhook trigger via CircleCI is not working - e.g. ansible-galaxy is not registering it.

Update: seems like according to the code only circleci is currently being supported. E.g. would be cool if there were general trigger support so it can be triggered from any cicd-server (incl. jenkins)

Copied from original issue: ansible/galaxy-issues#267

sorry, meant to say currently only travis-ci is supported. Thanks!

So... this week Travis CI basically neutered itself as a reasonable way to maintain open source CI workflows, at least for anyone who maintains more than one or two bits of content.

I'm going to have to switch all my roles to GitHub Actions CI, and I'm looking for a way to notify Galaxy from there to import the role. Is this possible already? This issue is a bit old, and maybe the functionality already exists, but my Googling has been fruitless so far.

For GitHub Actions, it looks like @robertdebock maintains https://github.com/marketplace/actions/publish-ansible-role-to-galaxy — though as an alternative, you could add a workflow task like the following:

      - name: Trigger a new import on Galaxy.
        run: >-
          ansible-galaxy role import
           --api-key ${{ secrets.GALAXY_API_KEY }}
           $(echo $GITHUB_REPOSITORY | cut -d/ -f1)
           $(echo $GITHUB_REPOSITORY | cut -d/ -f2)

The annoying part of this (at least for me, since my roles are under my name and not an organization) is that I have to add a GALAXY_API_KEY secret to each and every repository in my namespace. It'd still be nice if I could just curl https://galaxy.ansible.com/api/v1/notifications/ from the action and it wouldn't require the secret or even installation of Ansible to run the ansible-galaxy command (or integrating a 3rd party Action, which I can't audit except for pinning at a certain commit—and even then the underlying Docker image version can't be pinned).

I agree in the usefulness of https://galaxy.ansible.com/api/v1/notifications/ for having frictionless build status updates.

I believe what is needed here is - not integrations for a myriad of different CI tools – but simply #2530, which merely requests that the schema of required fields for the https://galaxy.ansible.com/api/v1/notifications/ POST API endpoint be documented somewhere.

Given that, developers can make integrate with various CI tools by transforming the build attributes into the appropriate JSON schema. In GitHub Actions in particular, this would be easy to add as an Action.