Galaxy: Add ability to trigger content import from github actions

Created on 21 Oct 2019  路  6Comments  路  Source: ansible/galaxy

Feature Request

Use Case


Currently notifications implementation is hardcoded to only work from Travis.

https://github.com/ansible/galaxy/blob/71218eaa2a998b6f47cf7e1ce9068f1f694b7555/galaxy/api/views/notification.py

Proposed Solution


It would be advantageous to allow notifications from GitHub actions, it would be even better to allow notifications from anywhere given appropriate amount of configuration.

Alternatives


Currently any ansible galaxy roles have to run on Travis, for large projects this mean supporting multiple pipeline tools.

Implementation


For HTTP signatures github user PUBLIC KEYS could be used curl -O https://github.com/<username>.keys initially verify owners of galaxy content and origin of notifications.

typproposal

Most helpful comment

@chouseknecht - I believe this may be for roles鈥攊t seems that the role notification support only works for Travis CI, so users who want to switch role CI use to Actions are unable to do so (or, I guess any other CI system, for that matter).

In that case, you have to manually log into Galaxy and navigate to your content and click 'Import' any time you want it updated in Galaxy.

All 6 comments

Given that we're moving toward Collections, and one can simply publish using ansible-galaxy collection publish and a Galaxy token, this doesn't seem relevant.

@chouseknecht - I believe this may be for roles鈥攊t seems that the role notification support only works for Travis CI, so users who want to switch role CI use to Actions are unable to do so (or, I guess any other CI system, for that matter).

In that case, you have to manually log into Galaxy and navigate to your content and click 'Import' any time you want it updated in Galaxy.

I see it the same way as @wildone there should be a way to trigger the role import into the Galaxy via an API call or something like that so you don't have to rely on travis ci to automatically publish roles in the Galaxy.

Just cam accross this issue, but it looks like you could just call the ansible-galaxy executable from other CI systems. Should ansible-galaxy --token api-key-here github-user-or-org github-repo just work?

FYI I just use (for roles):

on:
  push:
    tags:
    - 'v*'

jobs:
  ...

  release:
    name: Publish to ansible-galaxy
    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
    needs: [pre-commit, molecule]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: robertdebock/[email protected]
      with:
        galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}

It might be good to have an "official" action though

For Drone CI I'm doing it like this now:

kind: pipeline
name: galaxy

platform:
  os: linux
  arch: amd64

steps:
- name: galaxy
  image: toolhippie/ansible:latest
  pull: always
  environment:
    galaxy_token:
      from_secret: galaxy_token
  commands:
    - ansible-galaxy role import --token $GALAXY_TOKEN ${DRONE_REPO_OWNER} ${DRONE_REPO_NAME}

trigger:
  ref:
  - refs/heads/master
  - refs/tags/**
  status:
  - success
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gustavomcarmo picture gustavomcarmo  路  7Comments

dallinb picture dallinb  路  5Comments

chouseknecht picture chouseknecht  路  6Comments

robertdebock picture robertdebock  路  7Comments

chouseknecht picture chouseknecht  路  5Comments