rvm1-ansible icon indicating copy to clipboard operation
rvm1-ansible copied to clipboard

Releases not being pulled by Ansible Galaxy

Open mmolinac opened this issue 2 years ago • 16 comments

I've noticed that the last version published in Ansible Galaxy is 2.1.2. However, according to the Contributing guidelines page, a new release on GitHub and adding a tag to the master branch is all that's required for it to work. Looks like something else is missing, because new version 2.2.0 is tagged and it's not on Ansible Galaxy.

mmolinac avatar Apr 08 '22 06:04 mmolinac

It could be related to tests not building on Travis CI. I'm afraid I'm not familiar with the errors on some of the tests (CentOS).

mmolinac avatar Apr 08 '22 06:04 mmolinac

@lpaulmp @thbar @sfgeorge any idea?

pkuczynski avatar Apr 08 '22 20:04 pkuczynski

I looked a bit into this, just sharing initial bits at this point.

The Travis setup has been removed in https://github.com/rvm/rvm1-ansible/pull/235.

It used to include this:

https://github.com/rvm/rvm1-ansible/blob/0fcf5f38ec5084115ee665f1fa22898fcf52024b/.travis.yml#L54-L55

I have no idea if it worked or not, but it looks like an interesting suppression, which could be a cause.

Also I came across this interesting post which mentions that also.

https://www.jeffgeerling.com/blog/2020/automatically-building-and-publishing-ansible-galaxy-collections

I believe re-instating a post-release (or post something) POST over there will likely help.

I will see if I can make some time to re-instate that this week (but please anyone feel free to jump at it whenever you want if it's doable on your side).

thbar avatar Apr 10 '22 09:04 thbar

There are plenty of gha which allows to send web hook notifications. Thing is that Ansible Galaxy seems to only support Travis at the moment: https://github.com/ansible/galaxy/issues/1379

Maybe we should just mimic travis payload, as someone suggested? @sfgeorge do you wanna have a look at this or shall we wait for @thbar?

pkuczynski avatar Apr 19 '22 22:04 pkuczynski

Looks like @sfgeorge already had a look into this https://github.com/ansible/galaxy/issues/46 and gave up? Can you say something about it @sfgeorge ?

pkuczynski avatar Apr 19 '22 22:04 pkuczynski

Some suggestions here too https://github.com/ansible/galaxy/issues/2070

pkuczynski avatar Apr 19 '22 22:04 pkuczynski

@pkuczynski I didn't start any actual legwork on it, but my comment on ansible/galaxy#46 suggests that perhaps someone write a reusable GitHub Action that uses GitHub Actions many available context variables and transforms them to make a POST to Ansible Galaxy mimic'ing a POST from Travis-CI.

Pro: Would avoid having to touch a line of code of Galaxy.
Cons: Some might consider this a kludge. (I think of it as just re-using an "API" that's already been established.)

sfgeorge avatar Apr 19 '22 22:04 sfgeorge

So it looks there are couple of GHA which allows to achieve the same result: https://github.com/marketplace?type=actions&query=galaxy+

@sfgeorge would you like to tackle that as you were the original author of CI change?

pkuczynski avatar Apr 20 '22 14:04 pkuczynski

@pkuczynski short answer – Yeah, I can definitely take a stab, will do 👍

Longer answer – Those solutions use ansible-galaxy role import ..., which to my understanding will publish the latest version of the role, but not update the build status. In truth, we should do both. I can take a stab at each.

sfgeorge avatar Apr 20 '22 14:04 sfgeorge

Awesome! Thanks!

pkuczynski avatar Apr 20 '22 15:04 pkuczynski

@sfgeorge any chance you can give it a shot soon?

pkuczynski avatar May 09 '22 21:05 pkuczynski

For anyone wondering how to install 2.2.0 in the meantime: As a workaround you can use $ ansible-galaxy install https://github.com/rvm/rvm1-ansible/archive/refs/tags/v2.2.0.tar.gz

claasz avatar May 25 '22 12:05 claasz

@pkuczynski Apologies, it may be a little while before I can get to this due to other commitments.

sfgeorge avatar May 26 '22 14:05 sfgeorge

For anyone wondering how to install 2.2.0 in the meantime: As a workaround you can use $ ansible-galaxy install https://github.com/rvm/rvm1-ansible/archive/refs/tags/v2.2.0.tar.gz

Still an issue:

TASK [rvm.ruby : Import GPG keys from keyservers] ****************************************************************************************************
failed: [localhost] (item=hkp://pool.sks-keyservers.net) => {"ansible_loop_var": "item", "changed": false, "cmd": "gpg --batch --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB", "delta": "0:00:20.045397", "end": "2022-06-13 14:08:56.849421", "item": "hkp://pool.sks-keyservers.net", "

ok, this works:

$ cd /home/lkyrala/.ansible/roles
$ ansible-galaxy install https://github.com/rvm/rvm1-ansible/archive/refs/tags/v2.2.0.tar.gz
$ rm -rf rvm.ruby
$ mv v2.2.0 rvm.ruby

then run your playbook as usual:

$ ansible-playbook ...
...
TASK [rvm.ruby : Import GPG keys from keyservers] ****************************************************************************************************
ok: [localhost] => (item=hkp://keys.openpgp.org)
...

coldnebo avatar Jun 13 '22 18:06 coldnebo

@sfgeorge Have you been able to give a look at the publishing issue?

mmolinac avatar Sep 22 '22 15:09 mmolinac

Unfortunately I haven't had time to do this. But I want to share my understanding of a few options we have for solving this problem if someone is able to take a stab.

Option 1 – ansible-galaxy import (probably easiest)

By adding a ansible-galaxy import command to the CI/CD process, we can trigger galaxy importing the latest release.

Here's an example (thank you @geerlingguy).

Option 2 – Migrate to a Collection

We could migrate this standalone galaxy role to a role in a Collection.

This would the Galaxy /v2 API as opposed to /v1. However, /v1 is by no means deprecated. There is divided opinion on whether migrating to /v2 provides any particular benefit; some folks feel like the release of /v2 was rushed and problematic.

Option 3 – Support build notifications from GitHub Actions

Sadly, Ansible Galaxy only supports build status updates from the proprietary Travis CI JSON payload schema. To my knowledge, this might be the only Option that includes getting Galaxy to accurately show a projects builds as passing/failing.

We could write a reusable GitHub Action that takes facts from a GitHub Action Job, transforms them into the proprietary format, and pushes the JSON payload to Galaxy.

https://github.com/ansible/galaxy/issues/46#issuecomment-1076774067

Option 3 has the most features, and Option 1 is by far the simplest to implement.

sfgeorge avatar Sep 22 '22 16:09 sfgeorge