MonolithProjects / ansible-github_actions_runner

Ansible Role to deploy GitHub Actions self-hosted runner
https://galaxy.ansible.com/ui/standalone/roles/monolithprojects/github_actions_runner/
MIT License
190 stars 77 forks source link

feat(ci): parameterise out github account #210

Closed lewismiddleton closed 5 months ago

lewismiddleton commented 5 months ago

Description

Parameterises the github_account and github_repo used in the molecule test suite. Pulls these values from environment variables instead of hard coding. Had to change Github Workflows to account for this change.

This makes testing more approachable for other contributors as they don't have to make changes to the working directory to run tests.

Type of change

How Has This Been Tested?

I've run all 4 test scenarios against a Github org that I maintain. 3 of them (default, repo, org) passed, the custom_env scenario failed for an unrelated reason, I'll add a comment to this PR explaining what I think the issue is.

lewismiddleton commented 5 months ago

I think the custom_env test scenario is broken because the verify.yaml stage is expecting to find a runner called ubuntu16-latest but this is not specified at the converge.yaml stage so defaults to the hostname (ubuntu22-latest) .

This results in an error ``` TASK [Debug | var registered_runners] ****************************************** ok: [ubuntu22-latest] => { "registered_runners.json.runners": [ { "busy": false, "id": 29, "labels": [ { "id": 1, "name": "self-hosted", "type": "read-only" }, { "id": 2, "name": "Linux", "type": "read-only" }, { "id": 3, "name": "X64", "type": "read-only" }, { "id": 4, "name": "label1", "type": "custom" }, { "id": 5, "name": "repo-runner", "type": "custom" } ], "name": "ubuntu22-latest", "os": "Linux", "status": "online" } ] } TASK [Check Runner] ************************************************************ fatal: [ubuntu22-latest]: FAILED! => {"assertion": "runner_name in registered_runners.json.runners|map(attribute='name')|list", "changed": false, "evaluated_to": false, "msg": "Assertion failed"} PLAY RECAP ********************************************************************* ubuntu22-latest : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 ```

Interestingly, there's a similar line in the default scenario's verify.yaml but this doesn't cause an error because it doesn't check the runners by name. This seems to be a change introduced in this commit.

MonolithProjects commented 5 months ago

I think the custom_env test scenario is broken because the verify.yaml stage is expecting to find a runner called ubuntu16-latest but this is not specified at the converge.yaml stage so defaults to the hostname (ubuntu22-latest) .

This results in an error Interestingly, there's a similar line in the default scenario's verify.yaml but this doesn't cause an error because it doesn't check the runners by name. This seems to be a change introduced in this commit.

Thx @lewismiddleton. That will be probably just some leftovers from my testing. I will look on it.